does python have useless destructors?
Donn Cave
donn at u.washington.edu
Thu Jun 17 12:58:30 EDT 2004
In article <m3k6y6o8cd.fsf at pc150.maths.bris.ac.uk>,
Michael Hudson <mwh at python.net> wrote:
> Donn Cave <donn at u.washington.edu> writes:
> > In article <m3fz8xozi1.fsf at pc150.maths.bris.ac.uk>,
> > Michael Hudson <mwh at python.net> wrote:
> > > Manlio Perillo <NOmanlio_perilloSPAM at libero.it> writes:
> > ...
> > > > Since __del__ isn't really 'useful', *maybe* a better solution is to
> > > > add another special method for classes, ad example a __finalize__
> > > > method.
> > >
> > > Yes! I'm not sure __finalize__ is really the best name, but that's
> > > for another day.
> >
> > Couldn't the name be __del__?
>
> As I think I said in one of the emails in the thread linked to from
> PEP 310, life would be much easier if it wasn't.
>
> > Given the opportunity to have both, and the assurance that
> > __finalize__ will be called and __del__ might not, what
> > functionality would you leave in __del__?
>
> None at all! This is my cunning plan...
You're too deep for me.
> > > I would urge everyone participating in this thread to read PEP 310,
> > > the email conversation linked therein and (optional) *understand* it.
> >
> > It seems to be superficially similar to finalization,
>
> OK, I've found this thread pretty hard to follow. What is
> "finalization" in context?
Operational definition would be `call __del__ or its C equivalent',
at the effective end of the object's lifetime. That's the way
I understand it - notify object that its time is up, let it do
its final things.
Donn Cave, donn at u.washington.edu
More information about the Python-list
mailing list