unloading a module created with imp.new_module

Chris Angelico rosuav at gmail.com
Mon Nov 24 09:36:31 CET 2014

On Mon, Nov 24, 2014 at 6:27 PM, Patrick Stinson <patrickkidd at gmail.com> wrote:
> How does the __del__ method have a reference to the module’s globals dict?
> because it references the print function?
> Crazy. Is there any other way to comfort when a module is being deleted
> beside defining a class object with a printing dtor?

Functions have references to their modules. That's how they know what
globals to use.


More information about the Python-list mailing list