Closed
Description
NoneType
is a mangled up mess in the type realm and should never be used in a typing context.
With the special case of None
being a secret alias to NoneType
I think that many, many people are going to try to use NoneType
as an annotation. Adding a warning for the 99% of the time that it's invalidly used would be a great one.
I understand that there are always edge cases, and disabling those warnings with a type comment would be the way to go IMO.
from types import NoneType
def foo(a: NoneType): # sus alert, NoneType is a mess in the type realm, you should use `None` or `type[None]` instead.
print(isinstance(a, NoneType))