destructors -- when are they called?
Moshe Zadka
moshez at math.huji.ac.il
Tue May 30 02:03:56 EDT 2000
On Tue, 30 May 2000, Courageous wrote:
> When writing a C language extension, is it guaranteed that the
> moment your object's reference count is reduced to zero it's
> destructor will be called? (I have a situation in which this
> may matter).
It is true in the current implementation. The *language* makes no
gurrantees about when it calls destructors, if at all. If you need to
release resources in a timely fashion, use
try:
....
finally:
# release resources
In your Python code.
--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com
More information about the Python-list
mailing list