Adding attribute to object
marc.lentz at ctrceal.caisse-epargne.fr
Wed Dec 3 17:03:50 CET 2003
I've got a class "myClass" ... and i CAN'T EXTENDS this class!
But i can add NEW methods to "myClass", like that :
method = new.instancemethod( myNewMethod , None, myClass)
myClass.__dict__[method.__name__] = method
i'd like to add NEW attributs to "myClass" ...
i'm pretty sure it's possible (with "get/set-attr") ... but i don't know how
to do that
in fact, i'd like to wrap an newAttribut to an existingAttribut ...
can anyone drop me 3 lines on how to do that ?
More information about the Python-list