[issue37923] Combining typing.get_type_hints and inspect.signature
Larry Hastings
report at bugs.python.org
Sun May 2 21:04:25 EDT 2021
Larry Hastings <larry at hastings.org> added the comment:
"Type hints" and "annotations" aren't the same thing. And type hints are more opinionated about the values of annotations than would be appropriate for the inspect module. For example, typing.get_type_hints() wraps strings with ForwardRef, turns None into NoneType, and it ignores objects with a "__no_type_check__" attribute.
So, I think it might be okay to *add* a *new* function to the typing module that was equivalent to inspect.signature() (and typing.signature() seems like a good name here). I don't use type hints, so I don't have a strong opinion on that either way. But you definitely shouldn't modify inspect.signature() so it produces type hints.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37923>
_______________________________________
More information about the Python-bugs-list
mailing list