Python——"is None"与&quo

2017-03-29  本文已影响1776人  帅气的_xiang

is always returns True if it compares the same object instance

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
上一篇 下一篇

猜你喜欢

热点阅读