Unloading a module

lallous lallous at lgwm.org
Thu Oct 22 10:59:58 EDT 2009


Hello Group,

If a reference to an imported module reaches zero will Python cleanup 
everything related to that module and unload the compiled code, etc, etc...?

For example:

import sys
m = [__import__(str(x)) for x in xrange(1,4)]
del sys.modules['1']
del m[0]
print m

Is module['1'] really unloaded or just it is not reachable but still loaded?

Thanks,
Elias 




More information about the Python-list mailing list