[Baypiggies] On Python Design

Aahz aahz at pythoncraft.com
Thu Mar 6 16:50:55 CET 2008

On Wed, Mar 05, 2008, Glen Jarvis wrote:
> But, behind the scenes, as soon as DaCoolAPI is instantiated, config  
> files are parsed, external processes for monitoring are launched, etc.
> The problem is I had intended the entire time to do things, like clean- 
> up, when the DaCool object was ?done? (i.e., almost always at program  
> exit).
> In this test case, the DaCool.__del__ destructor is called without  
> worry. However, that is NOT a guarantee in the big picture (my much  
> larger app). Now, trying to get the Python atexit module 
> (http://docs.python.org/lib/module-atexit.html ) to do this same job is 
> tricker than it looks.

Another issue, of course, is that you need to record DaCool in some
robust external data structure (e.g. database) so that if DaCool gets
wedged or blows up you can still have some kind of cleanup process that
knows enough about DaCool to do the work.
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"All problems in computer science can be solved by another level of     
indirection."  --Butler Lampson

More information about the Baypiggies mailing list