[issue38605] [typing] PEP 563: Postponed evaluation of annotations: enable it by default in Python 3.10

Batuhan Taskaya report at bugs.python.org
Thu May 28 06:51:15 EDT 2020


Batuhan Taskaya <isidentical at gmail.com> added the comment:

>From now on, should typing.get_type_hints automatically resolve arguments too? An example would be this;

import typing
T = typing.TypeVar("T")
class Loop(typing.Generic[T]):
    subloop: typing.Final["Loop[int]"]
print(typing.get_type_hints(Loop))
>>> {'subloop': typing.Final[__main__.Loop[int]]}
If we run the same code under future annotations
>>> {'subloop': typing.Final[ForwardRef('Loop[int]')]}

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38605>
_______________________________________


More information about the Python-bugs-list mailing list