Is there a way to hook into module destruction?
i3dmaster at gmail.com
Sun Jun 17 08:45:51 CEST 2007
On Jun 16, 11:03 pm, Gerald Kaszuba <gerald.kasz... at gmail.com> wrote:
> On Jun 17, 6:16 am, Neal Becker <ndbeck... at gmail.com> 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.
> Seehttp://docs.python.org/ref/customization.htmlfor the docs.
> Gerald Kaszubahttp://geraldkaszuba.com
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