3 Suggestions to Make Python Easier For Children

Marko Rauhamaa marko at pacujo.net
Tue Aug 5 09:19:48 EDT 2014


Skip Montanaro <skip at pobox.com>:

> On Tue, Aug 5, 2014 at 7:04 AM, Marko Rauhamaa <marko at 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.


Marko



More information about the Python-list mailing list