is None or == None ?
stefan_ml at behnel.de
Fri Nov 6 14:33:14 CET 2009
mk, 06.11.2009 14:20:
> Some claim that one should test for None using:
> if x is None:
Which is the correct and safe way of doing it.
> ..but the standard equality which is theoretically safer works as well:
> if x == None:
Absolutely not safe, think of
def __eq__(self, other):
return other == None
print Test() == None, Test() is None
More information about the Python-list