On Wed, Apr 27, 2011 at 5:54 PM, Thomas 'PointedEars' Lahn < pointede...@web.de> wrote:
> Jack Bates wrote: > > Faced with the real potential for reference cycles, how can you reliably > > call code - but wait until an object no longer exists or is > > "unreachable"? > > For normal program termination, the solution is the `atexit' module (as > used > e.g. in < > http://code.activestate.com/recipes/523007-semi-automatic-resource- > management-with-autoclose/>, however it is considered better style to > explicitly call methods that free resources, and `del' object references. > > As for abnormal program termination, I think there is no way to deal with > signals that signal.signal() cannot handle. > Sometimes __enter__, __exit__ and "with" combine well for such a purpose, depending on what the actual purpose is.
-- http://mail.python.org/mailman/listinfo/python-list