I knew I was missing something. Agree, annotations are not necessarily type hints.
On Fri, 2021-01-15 at 10:56 -0800, Larry Hastings wrote: > > 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 -- 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/C3HINI65UIFCA4EON55WMR6YR6THXQCQ/ Code of Conduct: http://python.org/psf/codeofconduct/