On Tue, Dec 3, 2013, at 12:14, Piotr Dobrogost wrote: > 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'?
The getattr function is meant for when your attribute name is in a variable. Being able to use strings that aren't valid identifiers is a side effect. Why are you designing classes with attributes that aren't valid identifiers? -- https://mail.python.org/mailman/listinfo/python-list