This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kj
Recipients gvanrossum, kj, sobolevn
Date 2021-09-25.15:37:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1632584236.3.0.752422323738.issue45283@roundup.psfhosted.org>
In-reply-to
Content
This makes ``get_type_hints`` quite opinionated and backwards incompatible. The first line the docs says "This is often the same as obj.__annotations__".

I also agree with Guido. FYI, we've tried to *reduce* usage of `_type_check` in new features since version 3.10. We've found that they make `typing_extensions` operability with `typing` worse. For example, the whole of PEP 612 in `typing_extensions` required lots of hacks to work with typing's Callable.

If you're really vouching for this change. We probably need a 2 major version deprecation period (with warnings telling the user their current type hints are invalid) *plus* asking typing-sig/python-dev if the runtime type hints users will be affected. See [PEP 387](https://www.python.org/dev/peps/pep-0387/) for more info.

On the other hand, we now have a less-opinionated alternative to ``get_type_hints`` with ``inspect.get_annotations``, but it can't do as much (like resolving ForwardRef).
History
Date User Action Args
2021-09-25 15:37:16kjsetrecipients: + kj, gvanrossum, sobolevn
2021-09-25 15:37:16kjsetmessageid: <1632584236.3.0.752422323738.issue45283@roundup.psfhosted.org>
2021-09-25 15:37:16kjlinkissue45283 messages
2021-09-25 15:37:16kjcreate