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

Dave Angel davea at davea.name
Tue Dec 3 12:48:38 EST 2013


On Tue, 3 Dec 2013 09:14:49 -0800 (PST), Piotr Dobrogost 
<p at google-groups-2013.dobrogost.net> wrote:
> I find global getattr() function awkward when reading code.

Me too. 
> 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?

There is.  Just use a dictionary.

-- 
DaveA




More information about the Python-list mailing list