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

STINNER Victor report at bugs.python.org
Tue May 26 16:45:55 EDT 2020


STINNER Victor <vstinner at python.org> added the comment:

> The second problem is `inspect.signature`. If we don't resolve annotations there and continue it is definitely going to break some code.

Would you mind to elaborate why would it break some code? Consumers of annotations should already be prepared to get directly types or strings, no?

> If we resolve, that would mean that annotations must able to point something real (and this might not be the real case if the user uses a string annotation etc.) and will break code. (both tried and both breaks different modules on the stdlib tests)

I expect that resolving has an impact on performance, whereas the caller may not use annotations at all but only cares of the number of parameters or their name.

It would be resonable to not resolve annotations in signature() by default. If someone cares, maybe a new parameter can be added to resolve annotations?

----------

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


More information about the Python-bugs-list mailing list