Hello,
On Mon, 18 May 2020 02:39:27 +0100
MRAB
Or maybe we could leverage the new walrus operator and write
str := (int)
It would be closer to the existing annotation if we could write:
[int] -> str
To make it clear, the talk is about "better", not "existing" annotation syntax, which is a square (literally) peg in a round hole. With PEP 0563, there's totally no need to wrap everything in square brackets, and atrocities like __class_getitem__ can be treated like an implementation detail of a particular Python implementation (CPython, that is). With PEP 0563, while evaluating annotations, one can just pass to eval() a suitably constructed "globals" dict, to enable any operators on any symbols (which would be represented by objects, not classes), or just operate on AST with even finer level of control. -- Best regards, Paul mailto:pmiscml@gmail.com