This might be a long shot but I thought I would try anyway.
Is there anyway to get a class to act like a NoneType
when it isn't one?
Lets say I have this object in a third party API that I can't change but I can monkey patch onto. Most of the methods can return this object at same stage. This object is the same as None
, as in they decided to use their own custom type to mean the same thing as None
.
Is it possible at all for me to monkey patch this type so that it will act like None when checked:
value = SpecialNoneClass()
if value is None:
print foobar