[Python-3000] Removing __del__

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Sep 24 03:12:05 CEST 2006

Giovanni Bajo wrote:

> What I am basically against is the need of removing an easy syntax which can
> have problematic side effects if you are not adult enough,

So what are you saying, that people who aren't adult enough
should be given a tool that's nice and easy but leads them
to write buggy code? That doesn't seem like a responsible
thing to do.

> complicated library workaround which requires deeper knowledge of Python
> (weakrefs, lambdas, early binding of default arguments, just to name three),

I don't see why it needs to be anywhere near that complicated.
All use of weakrefs can be hidden behind a call such as

   register_finalizer(self, func, *args, **kwds)

and we just need to say that func should be a plain function,
not a bound method of self, and self shouldn't appear anywhere
in the arguments.

Anyone who's not intelligent enough to understand and follow
those guidelines is not intelligent enough to avoid the
pitfalls of using __del__ either, IMO.


More information about the Python-3000 mailing list