It's clear to me that there was no clean solution in Python 2 to unload a module, and this was a known bug, that was set to be corrected.
The posts:
How do I unload (reload) a Python module? Remove an imported python module
of the year 2009 and 2010 confirm this lack of support for unloading a module.
I wonder if this was solved in Python 3.x. When I do, import os
, del os
, dir()
, the os
module is not there (at least not visible, usable). Is it gone?
The sys.modules
does still hold a reference to the module.
>>> import six
>>> del six
>>> sys.modules["six"]
<module 'six' from '/usr/lib64/python3.3/site-packages/six.py'>
sys.modules still holds a reference. So I don't think you can unload a module in Python 3.3 either.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments