To avoid that:
- subclass Test first
class SubclassTest(T):
pass
- assign the method to SubclassTest's attribute,
SubclassTest.dynamic = dynamic
- then assign the new class to magic variable __class__ :
t.__class__ = SubclassTest
t.dynamic()
Antoon Pardon wrote:
> But this will make the function a method to all instances of the class.
> Is that what you want? From your first post I had the impression you
> only wanted the function to be the method of one particular instance.
>
--
http://mail.python.org/mailman/listinfo/python-list