Change the class of an object
Alex Martelli
aleaxit at yahoo.com
Fri Apr 13 11:58:14 EDT 2001
"Fernando RodrÃguez" <spamers at must.die> wrote in message
news:6h3edtg8pbh77hcl62uo40ummipframksa at 4ax.com...
> Hi!
>
> Is it possible to change an object's class in runtime? O:-)
Yes, the .__class__ field of any instance object is a
writable attribute. You'll have to ensure that the state
of the object makes sense in terms of its new class, etc.
Alex
More information about the Python-list
mailing list