[Python-3000] PEP: Eliminate del (original) (raw)

Giovanni Bajo rasky at develer.com
Tue May 1 13:32:52 CEST 2007


On 01/05/2007 9.31, Raymond Hettinger wrote:

PEP: Eliminating del

sigh I'm still -1, but I won't revive the discussion of course.

I would still like if the PEP listed the alternative me and others were proposing, that is changing the semantic of del (or dropping del in favor of a new close method with the new semantic) such as:

  1. It is guaranteed to be called only once per object.
  2. In case of circular reference, del methods are called in random order on the objects of the cycle, and then the cycle is broken. (This is because step #1 fixes the main problem with calling del in random orders).

In fact, your PEP concentrates on the problem of implicit finalization, which I don't think it's generally perceived as the problem with del. I'm still a strong proponent of implicit finalization (aka RAII). It always worked well for me.

The problem is that del currently breaks implicit finalization, causing garbage if it's used by objects in a cycle. With the fixes above, I'd use it more not less.

Giovanni Bajo



More information about the Python-3000 mailing list