Module: Destructor/Cleanup Code/etc

Alex Martelli aleaxit at yahoo.com
Sun Oct 19 06:32:40 EDT 2003


Dylan Shell wrote:

> How do I register a clean up function for a module written in C? While
> I can find plenty of documentation for the "init<module_name>"
> function... I don't see a single reference on a "done<module_name>" or
> something analogous.

Call function register from standard library module atexit, passing it
the Python-callable function object you want to be called at exit,
and optionally positional and keyword arguments you want to be
used when that function is called.  I.e., just like for a module written
in Python.


Alex





More information about the Python-list mailing list