overriding bool() for custom class
Is this Python 2.x or Python 3.x? For Python 2.x you are looking to override __nonzero__
instead.
class test:
def __nonzero__(self):
return False
If you want to keep your code forward compatible with python3 you could do something like this
class test:
def __bool__(self):
return False
__nonzero__=__bool__