[issue42881] Should typing.get_type_hints change None annotations?

2021-01-10 Thread Guido van Rossum
Guido van Rossum added the comment: I agree this is a bit unfortunate, but I also think it's a bit late to change now. However *if* we're going to change it we should do it now (in 3.10) or never. Given that we never *write* type(None) in annotations, it's unfortunate to get that back whene

[issue42881] Should typing.get_type_hints change None annotations?

2021-01-10 Thread Eric V. Smith
Eric V. Smith 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 on

[issue42881] Should typing.get_type_hints change None annotations?

2021-01-10 Thread Eric V. Smith
Eric V. Smith added the comment: Notice that this isn't just for __init__ or return types, it happens with any annotations (here, with 3.8): >>> def g(i: None): pass ... >>> g.__annotations__ {'i': None} >>> get_type_hints(g) {'i': } >>> I just noticed that PEP 484 also says: https://www.py

[issue42881] Should typing.get_type_hints change None annotations?

2021-01-10 Thread Larry Hastings
New submission from Larry Hastings : PEP 484 says: (Note that the return type of __init__ ought to be annotated with -> None. The reason for this is subtle. [...] https://www.python.org/dev/peps/pep-0484/#the-meaning-of-annotations If you follow this advice, then call typing.get_