does python have useless destructors?

Donn Cave donn at u.washington.edu
Thu Jun 17 18:28:28 EDT 2004


In article <pan.2004.06.17.19.02.40.902141 at knm.org.pl>,
 Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> wrote:

> On Thu, 17 Jun 2004 11:51:34 -0700, Donn Cave wrote:
> 
> > Anything you can write with it, you can write without it by
> > simple substitution of try/finally.
> 
> This is OK, because try/finally does provide the necessary functionality.
> It only has ugly syntax for this purpose.
> 
> Well, PEP 310 syntax is not that great either - it requires introducing an
> indentation level - but it seems Python syntax is incompatible with other
> choices.
> 
> > That's not true of the finalization that I have now in C Python, there's
> > no effective substitute for that.
> 
> It doesn't matter because it's impossible to implement well on other
> runtimes. It would require reimplementation of the whole GC functionality,
> including a periodic GC which breaks cycles, ignoring the GC available
> in the runtime.
> 
> It was simply a bad idea to rely on finalization to free precious external
> resources in the first place.

After what must be at least your third repetition of this point,
you must be wondering if A) people aren't capable of understanding
it, or B) they don't accept some implicit assumption.  Could it be
that it isn't as obvious to everyone that Python should limit itself
to some least common denominator of all languages' runtimes?

In the current situation, we are stuck with a feature that has some
reliability issues in C Python, and evidently doesn't work at all in
Java Python, but that _does work_ in C Python and is deeply useful,
not just a convenience or an aid to readability but a fundamental
difference in how programs can be structured.  There are these two
halves to this issue, and you can't make that other half go away by
pretending that it was all just `simply a bad idea'

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list