andz
andz copied to clipboard
Change the type hint "None" to "NoneType" (which is the actual type)
None
is an object of type NoneType
. However, in many cases, I specify that the type of parameter or return value is None
, but this latter is an object, so this is wrong. To use NoneType
, we could do as follows
NoneType = type(None)
Edit: I just found out this: https://www.python.org/dev/peps/pep-0484/#using-none. How stupid is it? Only because None is the only object of NoneType, it doesn't make it the class itself.