Hallöchen!

"Terry Reedy" <[EMAIL PROTECTED]> writes:

> "Torsten Bronger" <[EMAIL PROTECTED]> wrote:
>
>> Is there a way to detect whether the program is being terminated?
>
> See atexit module to register cleanup functions that run *before*
> the interpreter starts haphazardly deleting stuff.

So I could register a function that sets a global variable called
"shutdown_has_begun" to "True".  Then I say

def __del__(self):
    if shutdown_has_begun: return
    ...

Alternatively, I could enclose every __del__ contents block with a
"try" whithout catching anything, just to suppress the error
messages.

However, all of this is not pretty pythonic in my opinion.  Is it
that exotic to want to call functions from within __del__?

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to