does python have useless destructors?
Christos TZOTZIOY Georgiou
tzot at sil-tec.gr
Tue Jun 22 05:35:18 EDT 2004
On 14 Jun 2004 00:00:39 -0700, rumours say that dkturner at telkomsa.net
(David Turner) might have written:
[snip text by Isaac To]
>You don't have to specify the finalization time in order to make the
>destructors work. Destruction and finalization are *different
>things*.
>The D programming language somehow contrives to have both garbage
>collection and working destructors. So why can't Python?
CPython for the time being reliably calls __del__ methods upon the
object's end of life, *unless* the object is part of a reference cycle.
There are ways to break these cycles.
In reply to your question, "why can't Python?", I say: "There are no
stack-allocated objects in Python". Counter questions: does D have
heap-allocated objects? If yes, how are they finalised before being
destructed? And what happens to references to these objects after their
destruction?
--
TZOTZIOY, I speak England very best,
"Tssss!" --Brad Pitt as Achilles in unprecedented Ancient Greek
More information about the Python-list
mailing list