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

Piotr Dobrogost p at google-groups-2013.dobrogost.net
Tue Dec 3 18:14:49 CET 2013


Hi!

I find global getattr() function awkward when reading code.
What is the reason there's no "natural" syntax allowing to access attributes with names not being valid Python identifiers in a similar way to other attributes?
Something along the line of my_object.'valid-attribute-name-but-not-valid-identifier'?


Regards,
Piotr Dobrogost



More information about the Python-list mailing list