Ken Jin <kenjin4...@gmail.com> added the comment:

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).

----------
nosy: +kj

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45283>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to