what exactly is "None" ?

Paolo Invernizzi paoloinvernizzi at dmsware.com
Tue Mar 4 11:22:29 EST 2003


Andrei Doicin wrote:
> I know that "None" is the Boolean false value that
> gets thrown out when there's nothing to return or a
> function doesn't manage to reach the end of itself and thus "return
> whatever", but *what* (in Python terms) exactly is equal to "None" ???

The *equality* can be implemented using the special __eq__ method, so 
*what* is *equal* to *None* can be driven in the direction you want...

Strictly speaking only None==None because None *is* None!

> I ask this as I'm trying to set up some conditional statements that do
> something if "whatever" is equal to "None".
Then you must implement in *whatever* the __eq__ operator...
But, IMHO, you are looking at the problem in the wrong way...

Paolo






More information about the Python-list mailing list