Why is there no natural syntax for accessing attributes with names not being valid identifiers?
Ethan Furman
ethan at stoneleaf.us
Tue Dec 3 12:31:58 EST 2013
On 12/03/2013 09:14 AM, Piotr Dobrogost wrote:
>
> 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'?
When would you have attribute names that are not valid identifiers?
--
~Ethan~
More information about the Python-list
mailing list