does python have useless destructors?

Aahz aahz at
Sun Jun 13 15:29:06 CEST 2004

In article <e251b7ba.0406130400.b65e143 at>,
David Turner <dkturner at> wrote:
>Objects with a __del__ method shall be reference counted.  When the
>reference count reaches zero, the __del__ method shall be called, and
>any subobjects that have a __del__ method shall also be unreferenced.
>The point at which the memory allocated to the object is freed is
>largely irrelevant.  The point is that there's a predictable time at
>which __del__ is called.  This is what enables the RAII idiom.
>Now, this could be tricky to implement because we are now separating
>the concepts of "destruction" and "finalization".  But it's certainly
>not impossible, and it would add a powerful new concept to the
>language.  So I don't think the idea should be rejected out of hand.
>Is this clearer?

Problem is, that's exactly the situation we currently have in CPython, so
I don't see what the improvement is.  Are you suggesting that Jython
change its semantics?
Aahz (aahz at           <*>

"as long as we like the same operating system, things are cool." --piranha

More information about the Python-list mailing list