On 4/12/21 7:24 PM, Guido van Rossum wrote:
I've been thinking about this a bit, and I think that the way forward
is for Python to ignore the text of annotations ("relaxed annotation
syntax"), not to try and make it available as an expression.
To be honest, the most pressing issue with annotations is the clumsy
way that type variables have to be introduced. The current convention,
`T = TypeVar('T')`, is both verbose (why do I have to repeat the
name?) and widely misunderstood (many help request for mypy and
pyright follow from users making a mistaken association between two
type variables that are unrelated but share the same TypeVar
definition). And relaxed annotation syntax alone doesn't solve this.
Nevertheless I think that it's time to accept that annotations are for
types -- the intention of PEP 3107 was to experiment with different
syntax and semantics for types, and that experiment has resulted in
the successful adoption of a specific syntax for types that is wildly
successful.
I don't follow your reasoning. I'm glad that type hints have found
success, but I don't see why that implies "and therefore we should
restrict the use of annotations solely for type hints". Annotations are
a useful, general-purpose feature of Python, with legitimate uses
besides type hints. Why would it make Python better to restrict their
use now?
//arry/
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/TC2ZHBWDLB2NB7DV25T3EC2TIXHNBJDM/
Code of Conduct: http://python.org/psf/codeofconduct/