Changing the class of an instance

Richard Tobin richard at cogsci.ed.ac.uk
Wed Jul 12 13:19:43 EDT 2000


Is it legal (it seems to work) to change the class of an object by
assigning to its __class__ attribute?  In particular for the case where
the new class is a subclass of the old.

I'm not looking for an argument (not even the five minute one) about
whether it's a good idea, just whether it's legal.

-- Richard

-- 
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

"The Internet is really just a series of bottlenecks joined by high
speed networks." - Sam Wilson



More information about the Python-list mailing list