Why is there no natural syntax for accessing attributes with names not being valid identifiers?

Ethan Furman ethan at stoneleaf.us
Wed Dec 4 04:12:52 EST 2013


On 12/03/2013 09:45 PM, Tim Roberts wrote:
> Piotr Dobrogost <p at google-groups-2013.dobrogost.net> wrote:
>>
>> Attribute access syntax being very concise is very often preferred
>> to dict's interface.
>
> It is not "very concise".  It is slightly more concise.
>
>      x = obj.value1
>      x = dct['value1']
>
> You have saved 3 keystrokes.  That is not a significant enough savings to
> create new syntax.  Remember the Python philosophy that there ought to be
> one way to do it.

That should be "one obvious way".

On my keyboard, at least, those are an important three keystrokes!  ;)

To be clear, I am

-1

on the new syntax.

--
~Ethan~



More information about the Python-list mailing list