does python have useless destructors?

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Thu Jun 17 15:02:41 EDT 2004


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.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/




More information about the Python-list mailing list