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

Anthony Baxter anthony at interlink.com.au
Wed Feb 14 01:38:13 CET 2007


On Wednesday 14 February 2007 03:03, Guido van Rossum wrote:
> Not to me -- magic objects are harder to grok than magic syntax;
> the magic syntax gives you a more direct hint that something
> unusual is going on than a magic object. Also, Nick's examples
> show (conceptual) aliasing problems: after "x = attrview(y)",
> both x and y refer to the same object, but use a different
> notation to access it.

Just touching on this - I meant to earlier.

I'm really unsure why this is a problem. We already have similar 
cases, for instance dict.keys()/values()/items(). The globals() and 
locals() builtins also provide an alternate view with "different 
notation to access it". Since you're creating the view explicitly, 
I really don't see the problem - any more than say, creating a set 
from a list, or a dict from a list, or the like.

Anthony

-- 
Anthony Baxter     <anthony at interlink.com.au>
It's never too late to have a happy childhood.


More information about the Python-Dev mailing list