destructors -- when are they called?

Courageous jkraska1 at san.rr.com
Tue May 30 09:29:09 CEST 2000


Mark Hammond wrote:
> 
> This should be quite obvious from the Py_DECREF macro - it explicitely
> calls the delete function when the ref count hits zero.  In the current
> implementation, it is indeed guaranteed (even though the language spec
> specifically refuses to guarantee it)

Actually both of these are interesting data points. So what
you're saying is that code functionality which relies on a
0 object reference calling the destructor will work 100% of
the time now, but might break in the future.

I'm thinking I may implement a release() method on my deque
iterators instead of what I was doing (which was doing an
implicit release in the destructor). More explicit anyway...



C/



More information about the Python-list mailing list