destructor not called
Roy Smith
roy at panix.com
Sun Sep 28 12:59:29 EDT 2008
In article
<2a7dea43-378a-423f-a5bb-d904b7f97869 at p25g2000hsf.googlegroups.com>,
Marcin201 <marcin201 at gmail.com> wrote:
> I have a class which uses a temporary directory for storing data. I
> would like that directory to be removed when the class is no longer
> used. I have tried removing the temporary directory from the class
> destructor, however, it was never called.
The short answer is that destruction in Python is non-deterministic (a rude
shock if you're used to C++). What you probably want is the new "with"
statement (http://docs.python.org/ref/with.html).
More information about the Python-list
mailing list