Frank Niessink wrote: > Ziga Seilnacht: > > This method was changed in Python 2.5. Previously, two instancemethods > > compared equal if their im_self attributes were *identical* and their > > im_func attributes were equal. Now, they compare equal if their im_self > > attributes are *equal* and their im_func attributes are equal. > > Thanks Ziga, that explains very clearly why I get the behavior I see. > > > If you think this is a bug, you should report it to the bugtracker: > > http://sourceforge.net/bugs/?group_id=5470 > > Well, from where I am it sure feels like a bug in python, so I've > submitted a bug report: > http://sourceforge.net/tracker/index.php?func=detail&aid=1617161&group_id=5470&atid=105470
In the interests of practicality beating purity, I would agree that the 2.4 behavior is better. (I don't know if it would be classified as a bug; the behavior of methods under == isn't documented AFAICT.) There's no question that the 2.5 behavior is purer, but I can't imagine a single use case for it. In the meanwhile, you could work around it by using this function instead: def same_method(a,b): return a.im_class is b.im_class and a.im_func is b.im_func and a.im_self is b.im_self Carl Banks -- http://mail.python.org/mailman/listinfo/python-list