On 2014-08-05 14:19, Marko Rauhamaa wrote:
Skip Montanaro <s...@pobox.com>:

On Tue, Aug 5, 2014 at 7:04 AM, Marko Rauhamaa <ma...@pacujo.net> wrote:
I wonder if that should be built into dict.

Short answer, no. I'm sure it's been proposed before. Attributes ≠
keys. When you see something.somethingelse anywhere else in Python,
"somethingelse" is an attribute reference. When you see
something[somethingelse], "somethingelse" is an index value or key.
Why destroy that symmetry in dictionaries?

I'm not sure I fully appreciate the dichotomy (which you euphemistically
refer to as symmetry).

JavaScript objects have that feature. I find it mildly confusing
because whenever I see it I have to pause to consider whether the name
I am looking at is an attribute or a key.

What's the inherent difference between an attribute and a key.

An attribute is part of a container; a key is part of its contents.

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to