On Oct 30, 1:10 pm, Nick Stinemates <n...@stinemates.org> wrote: > > Some objects are singletons, ie there's only ever one of them. The most > > common singleton is None. In virtually every other case you should be > > using "==" and "!=". > > Please correct me if I am wrong, but I believe you meant to say some > objects are immutable, in which case you would be correct.
You're completely wrong. Immutability has nothing to do with identity, which is what 'is' is testing for: >>> t1 = (1,2,3) # an immutable object >>> t2 = (1,2,3) # another immutable object >>> t1 is t2 False >>> t1 == t2 True MRAB was refering to the singleton pattern[1], of which None is the predominant example in Python. None is _always_ None, as it's always the same object. 1: http://en.wikipedia.org/wiki/Singleton_pattern -- http://mail.python.org/mailman/listinfo/python-list