Dynamically Update Class Definitions?

Chris Spencer usenet.20.evilspam at spamgourmet.com
Sat Nov 12 11:11:09 EST 2005


Jean-Paul Calderone wrote:

> There are lots of cases where you cannot rebind the __class__ 
> attribute.  For a comprehensive treatment of this idea (but still not a 
> completely functionality implementation), take a look at 
> <http://cvs.twistedmatrix.com/cvs/trunk/twisted/python/rebuild.py?view=markup&rev=11450>.  
> On another note, the usage of threads in this code is totally insane and 
> unsafe.  Even for strictly development purposes, I would expect it to 
> introduce so many non-deterministic and undebuggable failures as to make 
> it cost more time than it saves.  You really want to stop the rest of 
> the program, then update things, then let everything get going again.

I used a thread to quickly detect changes in the source code, but you're 
absolutely right. In any non-toy application you'll definitely need 
control over when the upgrade process occurs. Thanks for the help.

Chris



More information about the Python-list mailing list