[Python-Dev] Summary of "dynamic attribute access" discussion

Aahz aahz at pythoncraft.com
Tue Feb 13 21:39:38 CET 2007


On Tue, Feb 13, 2007, Guido van Rossum wrote:
>
> I think the point of attrview() and x.[y] and getattr()/setattr() is
> that these should be usable regardless of whether the object is
> prepared for such use; they map directly to __getattr__ and
> __setattr__. If I had to design an object specifically for such
> dynamic access, sure, I'd implement __getitem__ and friends and the
> need wouldn't exist. For that specific object. But the use case of
> general objects is different.

My point is that I suspect that general objects are not used much with
getattr/setattr.  Does anyone have evidence counter to that?  I think
that evidence should be provided before this goes much further; perhaps
all that's needed is education and documentation.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"I disrespectfully agree."  --SJM


More information about the Python-Dev mailing list