[Tutor] Dynamically changing a class

Alan Gauld alan.gauld at btinternet.com
Wed Sep 5 09:40:58 CEST 2007


"Kent Johnson" <kent37 at tds.net> wrote

>> Wanted to change the mfunc method but ONLY for an instance, not a 
>> class:
>
> I believe the correct way to do this is to use the __get__() method 
> of
> the function object to create a bound method and assign that to the
> instance attribute:

Wow! Another new trick. I've never noticed __get__ before.
Time for some playing I think.

Thanks Kent,

Alan G 




More information about the Tutor mailing list