[Python-Dev] Re: PEP: Deferred Evaluation Of Annotations Using Descriptors

2021年1月15日 11:02:58 -0800

On 1/15/21 10:12 AM, Paul Bryan wrote:
I wonder if then the __co_annotations__ call and overwriting of __annotations__ should be explicitly caused by a to get_type_hints instead of (mysteriously) occurring on an attempt to getattr __annotations__.
I would say: absolutely not. While all "type hints" are annotations, not all annotations are "type hints". As mentioned previously in this thread, typing.get_type_hints() is opinionated in ways that users of annotations may not want. And personally I bristle at the idea of gating a language feature behind a library function. Besides, most users will never know or care about __co_annotations__. If you're not even aware that it exists, it's not mysterious ;-)
Cheers,
//arry/
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/JOBGFRXKFBB5TYEVGJZ7INEAEC4ZQDBY/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to