[issue1617161] Instance methods compare equal when their self's are equal

2008-03-07 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

> the change was meant to unify
> the behavior of built-in and
> user method objects

I don't think it achieved that.  Consider:

>>> [].index == [].index
False

but
>>> UserList().index == UserList().index 
True

--
nosy: +belopolsky

_
Tracker <[EMAIL PROTECTED]>

_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1617161] Instance methods compare equal when their self's are equal

2008-03-09 Thread Armin Rigo

Armin Rigo <[EMAIL PROTECTED]> added the comment:

My mistake, you are right.  I forgot about one of the many types that
CPython uses internally for built-in methods.  Indeed:

>>> [].index == [].index
False
>>> [].__add__ == [].__add__
True

I can fix this so that the answer is True in all cases; alternatively,
considering Frank Niessink's original issue, we could bring this
discussion to python-dev and decide what the correct behavior should be
and implement it consistently for all method types.

_
Tracker <[EMAIL PROTECTED]>

_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1617161] Instance methods compare equal when their self's are equal

2008-03-09 Thread Frank Niessink

Frank Niessink <[EMAIL PROTECTED]> added the comment:

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

_
Tracker <[EMAIL PROTECTED]>

_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1617161] Instance methods compare equal when their self's are equal

2008-03-09 Thread Alexander Belopolsky

Alexander Belopolsky <[EMAIL PROTECTED]> added the comment:

Armin,

I think this should be discussed on python-dev.  I don't understand your 
motivation for comparing methods of distinct but equal objects as equal.  
The callback argument on the other hand, is compelling.

_
Tracker <[EMAIL PROTECTED]>

_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1617161] Instance methods compare equal when their self's are equal

2008-03-09 Thread Paul Pogonyshev

Paul Pogonyshev <[EMAIL PROTECTED]> added the comment:

Since I'm not on python-dev, I'll mention here that the new behavior
makes no sense to me at all.  Which is best highlighted by Frank in
msg63414.

--
nosy: +_doublep

_
Tracker <[EMAIL PROTECTED]>

_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1617161] Instance methods compare equal when their self's are equal

2008-03-13 Thread Armin Rigo

Armin Rigo <[EMAIL PROTECTED]> added the comment:

Attached patch for python trunk with tests.
It makes all three method types use the identity of their 'self'.

--
keywords: +patch
Added file: http://bugs.python.org/file9666/method_compare.diff

_
Tracker <[EMAIL PROTECTED]>

_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1617161] Instance methods compare equal when their self's are equal

2010-07-16 Thread Mark Lawrence

Mark Lawrence  added the comment:

msg84597 is ambiguous.  At first readng I thought it meant "the patches have 
been committed to trunk and py3k".  Second time I think it means "yes this is 
still a problem".  What is the status?

--
nosy: +BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1617161] Instance methods compare equal when their self's are equal

2010-07-16 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I believe "Confirmed in trunk and py3k." means that the issue was verified to 
exist in trunk and py3k branches at the time of the message.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1617161] Instance methods compare equal when their self's are equal

2010-08-08 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
versions: +Python 3.2 -Python 2.7, Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1617161] Instance methods compare equal when their self's are equal

2013-01-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
versions: +Python 3.4 -Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1617161] Instance methods compare equal when their self's are equal

2009-03-30 Thread Daniel Diniz

Daniel Diniz  added the comment:

Confirmed in trunk and py3k.

--
nosy: +ajaksu2
stage:  -> patch review
type:  -> feature request
versions: +Python 2.7, Python 3.1 -Python 2.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com