Proposed Change for sys.exitfunc for version 1.6

Jonathan Polley jwpolley at collins.rockwell.com
Fri Apr 23 11:36:00 EDT 1999


I would like to propose adding a function to the module 'sys' that would
change (slightly) the behavior of sys.exitfunc.  I would like to add a
method that performs the same function as UNIX's 'atexit ()' function.
The reason is that I have some modules that would like to do some
cleanup when python terminates, but I don't want to have to add the code
required for them to remember the previous value of sys.exitfunc so they
can call that function (if present).  A method sys.atexit () would work
nicely.  It would allow me to add a series of exit functions and be
guaranteed that they would all be called at the termination of python
(so I can close files, purge queues, close sockets, etc.).  Does anyone
else think this would be a good idea???


Jonathan Polley
jwpolley at collins.rockwell.com





More information about the Python-list mailing list