[Python-3000] __del__ (was Re: PEPs update)
Phillip J. Eby
pje at telecommunity.com
Fri May 11 01:54:58 CEST 2007
At 07:27 PM 5/10/2007 -0400, Raymond Hettinger wrote:
>The PEP for eliminating __del__ seemed straight-forward at the
>outset, but the use case you presented doesn't seem to have a clean
>substitute (as it requires the object to be alive to finalize
>it). Other use cases do have a clean solution. So, I'll go forward
>with the PEP but am a bit disheartened that it is going to have to
>advise try/finally or somesuch for the harder cases.
By the way - another issue with removing __del__ is that try/finally
in generators (PEP 342) is implemented using it.
Which means that if you took away __del__ from the Python level, you
could still simulate it by saving a reference to a running generator
with a finally clause. Of course, that would have at least as many
problems as using __del__ directly, but there you go. :)
More information about the Python-3000
mailing list