Why is there no natural syntax for accessing attributes with names not being valid identifiers?
rustompmody at gmail.com
Thu Dec 5 05:48:29 CET 2013
On Thursday, December 5, 2013 8:13:49 AM UTC+5:30, Ian wrote:
> On Wed, Dec 4, 2013 at 3:09 AM, rusi wrote:
> > On Wednesday, December 4, 2013 2:27:28 PM UTC+5:30, Ian wrote:
> >> On Tue, Dec 3, 2013 at 11:31 PM, rusi wrote:
> >> > Its a more fundamental problem than that:
> >> > It emerges from the OP's second post) that he wants '-' in the attributes.
> >> > Is that all?
> >> >
> >> > Where does this syntax-enlargement stop? Spaces? Newlines?
> >> At non-strings.
> >> >>> setattr(foo, 21+21, 42)
> >> Traceback (most recent call last):
> >> File "<stdin>", line 1, in <module>
> >> TypeError: attribute name must be string, not 'int'
> > Not sure what's your point.
> There was no point. My comment was only meant to be amusing.
Duh! Im dense!
More information about the Python-list