This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author fniessink
Recipients arigo, belopolsky, fniessink, loewis
Date 2008-03-09.13:13:48
SpamBayes Score 0.05350129
Marked as misclassified No
Message-id <1205068430.15.0.143842617276.issue1617161@psf.upfronthosting.co.za>
In-reply-to
Content
Just to reiterate the original bug report: the issue (for me) is that
currently (python 2.5):
>>> [].__add__  == [].__add__
True
>>> [].__add__  == [1].__add__
False

Or, using a non-builtin class:
>>> class C(object):
...   def __eq__(self, other):
...     return False
...   def foo(self):
...      pass
...
>>> C().foo == C().foo
False
>>> class C(object):
...   def __eq__(self, other):
...     return True
...   def foo(self):
...     pass
...
>>> C().foo == C().foo
True

I think it makes little sense that the equality test for the instance
methods takes the equality of the instances into account. Imho, this
behaviour is inconsistent with the principle of no surprises. The
correct behaviour (again imho of course) is that instance methods only
compare equal to the same instance method of the same instance, where 
'same instance' is based on 'is' not on '=='.  

Cheers, Frank
History
Date User Action Args
2008-03-09 13:13:50fniessinksetspambayes_score: 0.0535013 -> 0.05350129
recipients: + fniessink, loewis, arigo, belopolsky
2008-03-09 13:13:50fniessinksetspambayes_score: 0.0535013 -> 0.0535013
messageid: <1205068430.15.0.143842617276.issue1617161@psf.upfronthosting.co.za>
2008-03-09 13:13:49fniessinklinkissue1617161 messages
2008-03-09 13:13:48fniessinkcreate