Emanuele D'Arrigo wrote:
Hi everybody, ...
f = aFunction
f is aFunction
True   <--- Ok, this seems reasonable. Nevertheless, I suspect I
            shouldn't quite rely on it.
Actually, that's fine, you are simply comparing a pair of references

class MyClass(object):
...     def myMethod(self):
...         pass
c = MyClass()
m = c.myMethod
m is c.myMethod
False  <--- What? Why is that?

Method access binds the instance in dynamically.

Comparing             m is c.myMethod
is like comparing     m is partial(MyClass.method, c)

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to