Is there a way to hook into module destruction?

i3dmaster i3dmaster at
Sun Jun 17 08:45:51 CEST 2007

On Jun 16, 11:03 pm, Gerald Kaszuba <gerald.kasz... at> wrote:
> On Jun 17, 6:16 am, Neal Becker <ndbeck... at> wrote:
> > Code at global scope in a module is run at module construction (init).  Is
> > it possible to hook into module destruction (unloading)?
> Try the __del__ method.
> See the docs.
> --
> Gerald Kaszuba

I doubt python calls __del__ when unloading module... and plus, I
don't really think python does module unloading though. del module
after import it got it removed from the global namespace but it does
not clean reference I bet, so completely unloading a module should
take more energy of that...


More information about the Python-list mailing list