Python——「is None」と「==None」の違い
329 ワード
is always returns True if it compares the same object instance
Whereas == is ultimately determined by the __eq__() method
i.e.
Whereas == is ultimately determined by the __eq__() method
i.e.
>>> class Foo(object):
def __eq__(self, other):
return True
>>> f = Foo()
>>> f == None
True
>>> f is None
False