Should it be possible to use None as a type (instead of NoneType)?

It’s more confusing for users though, for nearly all values (e.g. 1) we can have a type(value) (e.g. int). Same applies to None with NoneType, but here too, it’s not the same thing. type itself already is a special case in many ways, I don’t really see the usage of None being a type. None however is a Literal (an instance), like True and False are. If one wanted to make None a type, they may follow soon. These literals can be checked against with x is y, and there is no reason for isinstance(x, None) to work. Apart from it not being backwards compatible, and x is None being the established way to check for it, isinstance(x, None) seems confusing, as isinstance(x, y) requires type(x) == y.

Generally speaking, I’d be confusing, and there are other, more broadly established ways to check for it.

Also perhaps check out the assure keyword

1 Like