Re: delattr missing?

Guido.van.Rossum@cwi.nl
Mon, 15 Aug 1994 15:07:32 +0200

> While manipulating class members by name, I noticed that there is:
>
> a=getattr(instance, 'member') # a=instance.member
> setattr(instance, 'member', a) # instance.member=a
>
> but no function to do "del instance.member" by name. Am I the only
> one to have stumbled onto this (minor) problem? Is there a way to do
> it?

I guess it's just an oversight... And nobody missed it before. Would
it be acceptable if instead of adding a new function, I add the
"feature" that setattr(instance, 'member') is equivalent to
del instance.member?

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