Impossible to change methods with special names of instances of new-style classes?

Terry Reedy tjreedy at udel.edu
Wed Jul 9 21:38:46 CEST 2008



samwyse wrote:
> On Jul 8, 4:56 pm, Joseph Barillari <pyt... at barillari.org> wrote:
> 
>> My question is: did something about the way the special method names are
>> implemented change for new-style classes?

I believe the difference is that for new-style classes, when special 
methods are called 'behind the scenes' to implement built-in syntax and 
methods, they are looked up directly on the class instead of first on 
the instance.  Note that functions attached to instances are *not* 
methods and do not get combined with the instance as a bound method.




More information about the Python-list mailing list