[Python-ideas] Dict-like object with property access
Massimo Di Pierro
massimo.dipierro at gmail.com
Mon Jan 30 20:49:01 CET 2012
On Jan 30, 2012, at 1:39 PM, Masklinn wrote:
> On 2012-01-30, at 20:23 , Ethan Furman wrote:
>> Sure you do -- as soon as 'something' can be passed in via a variable:
> That's what getattr is for, isn't it?
>
> The issue I have is that, to me, string keys say "arbitrary" and attributes say "enumerated set".
I do not understand the distinciton. In fact getattr(x,...) functionally just delegates to getitem(x.__dict__, ...). I do not see why this delegation should not be achieved using the same operator __getitem__.
> Using one for the other? Wreaks that information. I like that Python (and most languages) makes the distinction, and I don't think Javascript and Lua should be emulated on this point.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
More information about the Python-ideas
mailing list