I don't like either on_exit or atexit, and surely there are systems
that have neither. The proper solution is to add an interface to
Python to register cleanup procedures for modules that need them. But
for the time being, this hack (or the version that Bill Jansen posted,
which does essentially the same thing without #define) is fine.
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
<URL:http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>