any way to know when the program is exiting?

Bruce Dodson bruce_dodson at bigfoot.com
Thu Jul 29 23:24:09 EDT 1999


It sounds like your class here relies on the existance of some other object
to help it clean up.  Presumably this same object is required to help in
your class's __init__ method, and presumably it is not OK to just skip the
cleanup on the way out for some reason.  In a case like this, I think it
would be safe to store a reference to that "global" as part of your
classes's __init__, as long as the "global" doesn't retain a reference to
your class instances.  Then you can guarantee that the "global's" reference
count won't hit zero until all the objects that need it have been deleted,
even if it is no longer a "global" by that time, so your class can send
messages to the "global" through the reference that it owns.





More information about the Python-list mailing list