On Thu, Mar 8, 2012 at 08:46, Ethan Furman <et...@stoneleaf.us> wrote: > I think it would be sad to lose that functionality. > > If we are going to, though, we may as well check the string to make sure > it's a valid identifier:
That would break even more code. I have encountered many cases of attributes that aren't valid identifiers, in particular using dots or dashes. Admittedly this is often in cases where the object has both attribute access and key access, so you can make foo['bar-frotz'] instead. But when should we then require that it is a valid identifier and when not? > --> class A: > --> pass > --> setattr(A, '42', 'hrm') > --> A.42 > File "<stdin>", line 1 > A.42 > ^ > SyntaxError: invalid syntax > > Doesn't seem very useful. You have to set it with setattr, so you have to get it with getattr. I don't see the problem. //Lennart _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com