del behavior 2

Eric Snow esnow at
Wed Jan 7 20:42:43 CET 2009

I was reading in the documentation about __del__ and have a couple of
questions.  Here is what I was looking at:

My second question is about the following:

"It is not guaranteed that __del__() methods are called for objects
that still exist when the interpreter exits."

I understand that and have seen it too.  That's fine.  But how do any
of you deal with things that are left open because you did not get a
chance to close them?  How do you clean up after the fact?  Do you
simply keep track externally the things that need to be cleaned up if
__del__ doesn't get a chance?  Any ideas?  Thanks


More information about the Python-list mailing list