Re: delattr missing?

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Tue, 16 Aug 1994 13:04:46 -0400

On Aug 16, 15:03, Fred Sells wrote:
>
> 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.
>

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've usually managed so far with setattr( obj, 'attr' , None ),
which is quite different semantics, and moves the special case into
my code, e.g. 'if hasattr( obj, attr ) and getattr( obj, attr ):' ]
^^^

- Steve Majewski (804-982-0831) <sdm7g@Virginia.EDU>
- UVA Department of Molecular Physiology and Biological Physics