order that destructors get called?
Alf P. Steinbach
alfps at start.no
Fri Apr 9 03:30:10 CEST 2010
* 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,
> 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.,
More information about the Python-list