Why is there no natural syntax for accessing attributes with names not being valid identifiers?
p at google-groups-2013.dobrogost.net
Wed Dec 4 22:54:00 CET 2013
On Wednesday, December 4, 2013 10:41:49 PM UTC+1, Neil Cerutti wrote:
> not something to do commonly. Your proposed syntax leaves the
> distinction between valid and invalid identifiers a problem the
> programmer has to deal with. It doesn't unify access to
> attributes the way the getattr and setattr do.
Taking into account that obj.'x' would be equivalent to obj.x any attribute can be accessed with the new syntax. I don't see how this is not unified access compared to using getattr instead dot...
More information about the Python-list