I would like to create a class that inherites from None
.
Tried this:
class InvalidKeyNone(None):
pass
but that giv
Subclassing None does not make sense, since it is a singleton and There Can Be Only One. You say you want a class with the same behaviour, but None does not have any behaviour!
If what you really want is a unique placeholder that you can return from a function to indicate a special case then simplest way to do this is to create a unique instance of object:
InvalidKey = object()
result = doSomething()
if result is InvalidKey:
...