[Python-3000] Misc. thoughts & questions re: xreload

Phillip J. Eby pje at telecommunity.com
Sat Mar 17 00:24:43 CET 2007


This is probably one of those cases where I've missed something obvious, 
but shouldn't it be sufficient for xreload() to use reload() to perform the 
central step of running the code in the cleared module dictionary?

There doesn't seem to be any reason to emulate all that reload() machinery, 
and it would then work for any and all importers (not to mention chopping 
out a bunch of code).  I'm also not clear on why the module dictionary even 
needs to be cleared, though it seems reasonable enough.  However, *not* 
clearing it would allow modules to be written so as to accomodate not 
clearing global data structures during reloading, by checking whether the 
structure already exists.

Btw, the _update() function looks like a great place to use that wonderful 
generic function prototype of Guido's, since it would allow developers to 
add extra reloading support for specialty objects, such as say, interfaces.  ;-)



More information about the Python-3000 mailing list