Has comparison of instancemethods changed between python 2.5 and 2.4?
Fredrik Lundh
fredrik at pythonware.com
Fri Dec 15 12:49:32 EST 2006
Thomas Heller wrote:
> It seems so:
>
> python -c "o = object(); print o.__str__ == o.__str__"
>
> prints True with Python 2.5, and False with Python 2.4.
that's not an instance method, though:
>>> o = object()
>>> type(o.__str__)
<type 'method-wrapper'>
using a real instance method, I get the same result under both versions:
>>> class foo(object):
... def bar(self):
... pass
...
>>> f = foo()
>>> type(f.bar)
<type 'instancemethod'>
>>> f.bar == f.bar
True
</F>
More information about the Python-list
mailing list