[issue42881] Should typing.get_type_hints change None annotations?

Eric V. Smith report at bugs.python.org
Sun Jan 10 11:32:35 EST 2021


Eric V. Smith <eric at trueblade.com> added the comment:

See also https://github.com/python/mypy/issues/640 "Support type(None) as a type", which was closed with "I don't think anyone cares". Jukka's comment was "Or maybe we should update PEP 484 to not suggest that type(None) is valid as a type, and None is the only correct spelling? There should one -- and preferably only one -- obvious way to do it etc."

Despite the fact that I'd also like to see only one way to do things, other than tests that will break when using get_type_hints instead of looking at annotations directly, I'm not sure it makes much difference. People already need to treat type(None) as equivalent to None for annotations: we're late to the game for making a change.

----------

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


More information about the Python-bugs-list mailing list