Problem with reimporting modules

Christoph Zwerschke cito at online.de
Sun Feb 11 16:25:03 EST 2007


Thanks for the detailed explanations, Gabriel.

> At that time, all values in the module namespace are set to 
> None (for breaking possible cycles, I presume). print_hello now has a 
> func_globals with all names set to None. (Perhaps the names could have 
> been deleted instead, so print_hello() would raise a NameError, but I'm 
> just describing the current CPython implementation)

Yes, that was the thing that confused me a bit. I had expected that an 
error is raised or that the namespace has a reference to the module and 
is reestablished when the module has been reloaded.

Anyway, I have solved the problem in a different way now.

-- Christoph



More information about the Python-list mailing list