Message402631
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). |
|
Date |
User |
Action |
Args |
2021-09-25 15:37:16 | kj | set | recipients:
+ kj, gvanrossum, sobolevn |
2021-09-25 15:37:16 | kj | set | messageid: <1632584236.3.0.752422323738.issue45283@roundup.psfhosted.org> |
2021-09-25 15:37:16 | kj | link | issue45283 messages |
2021-09-25 15:37:16 | kj | create | |
|