Why is there no natural syntax for accessing attributes with names not being valid identifiers?
Tim Roberts
timr at probo.com
Wed Dec 4 00:45:05 EST 2013
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.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list
mailing list