__nonzero__() overridden to return False : Nonzero : Class PYTHON TUTORIALS


PYTHON TUTORIALS » Class » Nonzero »

 

__nonzero__() overridden to return False


class C:
    def __nonzero__(self):
        return False

c = C()
print bool(c)
print bool(C)



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Class
» Nonzero