Has comparison of instancemethods changed between python 2.5 and 2.4?
Thomas Heller
theller at ctypes.org
Fri Dec 15 12:10:13 EST 2006
Frank Niessink schrieb:
[...]
> Now, with Python 2.5 (and not with Python 2.4) I have a callback that is
> not being added to the list because, apparently, it compares equal to
> some of the callbacks already in the list. However, the instance the two
> methods belong to are different, i.e. id(callback) returns different
> values for the two methods. Both callbacks are of type <type
> 'instancemethod'>. Further investigation shows that "observer ==
> observerList[1]" is True.
>
> Has instancemethod.__cmp__ changed between python 2.4 and 2.5?
>
It seems so:
python -c "o = object(); print o.__str__ == o.__str__"
prints True with Python 2.5, and False with Python 2.4.
Thomas
More information about the Python-list
mailing list