Emanuele D'Arrigo <manu3d <at> gmail.com> writes: > > >>> class MyClass(object): > ... def myMethod(self): > ... pass > ... > >>> c = MyClass() > >>> m = c.myMethod > >>> m is c.myMethod > False <--- What? Why is that? > > Can anybody shed some light? Or point to a resource to look at? Or > what's the bit of python's source code that is responsible for dealing > with those assignments?
Functions are descriptors (they have a __get__ method). Thus, every time a method is resolved, a new bound method object is created with the object passed to it. -- http://mail.python.org/mailman/listinfo/python-list