<< This seems like a poor argument for unregistering exit handlers. If you've registered an exit handler, why then explicitly do what you've already asked the system to do? >>
1. To free up memory for the rest of the program. 2. If the following block is in a loop, and you need to allocate & then deallocate resources multiple times.:
<< atexit.register(free_resource, x) atexit.register(free_resource, y) # do operations with x and y, potentially causing the program to exit ... # if nothing caused the program to unexpectedly quit, close the resources free_resource(x) free_resource(y) >>
<< Also, your proposed unregisterall() function would be dangerous. As an application writer you don't know what other parts of the system (libraries you use, for example) might have registered exit functions.
That's true...it would probably be better to expose the stack of registered functions. That way you can manually unregister functions you've registered.
_________________________________________________________________ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/