[Python-Dev] Re: [Python-checkins]python/dist/src/Modules gcmodule.c,2.33.6.5,2.33.6.6

Guido van Rossum guido@python.org
Tue, 08 Apr 2003 14:06:47 -0400


> This further confirms my opinion that __del__ methods are evil, and
> the language would be the better for their complete removal.

No can do.  There must be a way to force e.g. calling os.close() for
an integer file descriptor returned by os.open() without writing C
code.  But this should be exceedingly rare.

A quick inspection of the standard library found one other case:
flushing buffered data out.  I think that's also a valid use of
__del__.

> Failing that, perhaps they should be made a bit less dynamic, so
> that the GC can make reasonable assumptions about their existence
> without having to execute Python code.

+1

--Guido van Rossum (home page: http://www.python.org/~guido/)