Re: delattr missing?

Guido.van.Rossum@cwi.nl
Wed, 17 Aug 1994 14:46:15 +0200

Fred Sells:
> > I have not missed delattr, so take my comments with a grain of
> > salt.
> >
> > I would prefer that a specific delattr function be created than
> > giving setattr a 'special' case. In our own experience, developing
> > the ezX run time library, every special case developed a life of
> > its own, and gave birth to its own special case children.
> >
> > We have gone with Python becuase of its simple, yet elegant syntax.
> > This feature, like the desire for C brace syntax, detract from
> > Python.

Steven D. Majewski:
> However, I don't think 'setattr' with no value meaning to delete
> the attribute is a necessarily 'special case' in the *language*.
> I seems like a perfectly sensible semantics. I think what
> Guido meant was that it was a 'special case' for the *implementation*.
>
> But, I have no objection to 'delattr', either.

I guess Fred and others are right -- overloading delattr() on
setattr() is at least surprising. This is done at the C level, mostly
for historic reasons (and also because often there is a lot of common
checking for setattr and delattr), but there's no reason to let this
affect the interface to which Python users are exposed.

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
<URL:http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>