* Brendan Miller:
Thanks Steven and Gabriel. Those are very informative responses.

In my case my resource isn't bound to a lexical scope, but the:

def __del__(self,
                  delete_my_resource=delete_my_resource):

pattern works quite well. I've made sure to prevent my class from
being part of a circular reference, so that the __del__ shouldn't be
an issue.

It may work but is unfortunately not guaranteed to work.

Use a 'with' statement where you need guaranteed cleanup.


Cheers & hth.,

- Alf
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to