Reload Tricks

Kamilche klachemin at
Sat Jan 22 05:29:37 CET 2005

I want my program to be able to reload its code dynamically. I have a
large hierarchy of objects in memory. The inheritance hierarchy of
these objects are scattered over several files.

I find that after reloading the appropriate files, and overwriting the
__class__ of object instances, one more thing is necessary: reloading
the __bases__ of each reloaded class. If I don't do this, the modules
reloaded first point to old versions of the classes from later modules,
and when the later module is reloaded, it doesn't update the
inheritance hierarchy of classes already loaded.

This appears to be working... but now I'm wondering, what else did it
not change? Can I expect more toes to be blown off?


More information about the Python-list mailing list