reload()'ing modules and how it affects references

Alex cut_me_out at hotmail.com
Mon Jun 26 20:48:35 EDT 2000


Hi, Igor.

I posted something recently that does multiple reloads of all the
modules you specify in order to ensure that they are finally reloaded in
an order that respects their dependancies.  For each of the modules M,
it clears all the modules you've specified out of sys.modules, reloads
M, then looks at which of the other modules got reloaded to see what M
depends on.  After that, it does a crude topological sort on the
dependancy graph to decide what order they should be loaded in.  It
seemed to work on the cursory tests I made of it, but it would only help
for objects that actually get defined during one of the reloads.  For
instance, you would probably still have references to the old versions
of the classes in the __main__ namespace.

> X-news-hint: never quarrel with #:Erik

Erik Naggum?  That guy's a barrel of laughs. :)

Alex.



More information about the Python-list mailing list