<var> is None vs. <var> == None
steve at REMOVE-THIS-cybersource.com.au
Sat Jan 24 02:16:51 CET 2009
On Fri, 23 Jan 2009 16:28:15 -0800, Gary Herron wrote:
> If something
> *equals* None, it also *is* None. This is a consequence of the fact
> that there is only ever one value of None anywhere in the system.
> The only way something can *equal* None is if it *is* None.
>>> class Empty:
... def __eq__(self, other):
... return not bool(other)
>>> e = Empty()
>>> e == None
>>> e is None
More information about the Python-list