What use is this class?

fl rxjwg98 at gmail.com
Sun Nov 29 16:36:58 EST 2015


Hi,

When I search around tutorial about None, I came across this link:

http://jaredgrubb.blogspot.ca/2009/04/python-is-none-vs-none.html

I don't understand what use of this class example:



>>> class Zero(): # a class that is zero
...    def __nonzero__(self):
...       return False


I can only get the following code running:

cz1=Zero()
cz1.__nonzero__()
Out[119]: False


Here are my questions:
1. Is there any other means to use class Zero?
2. What connection to None on the original author's intention?


Thanks,



More information about the Python-list mailing list