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

Piotr Dobrogost p at google-groups-2013.dobrogost.net
Wed Dec 4 17:05:11 EST 2013


On Tuesday, December 3, 2013 6:48:38 PM UTC+1, Dave Angel wrote:
> On Tue, 3 Dec 2013 09:14:49 -0800 (PST), Piotr Dobrogost 
> 
> wrote:
> 
> > 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.

Object's attributes and dictionary's keys are quite different things. What about descriptors?

Regards,
Piotr



More information about the Python-list mailing list