Message 251263 - Python tracker
The name can be any str/unicode string, including language keywords:
>>> setattr(o, 'def', 'allowed')
>>> getattr(o, 'def')
'allowed'
>>> o.def
File "<stdin>", line 1
o.def
^
SyntaxError: invalid syntax
and even an empty string:
>>> setattr(o, '', 'mu')
>>> getattr(o, '')
'mu'
This includes instances of str and unicode subclasses, at least in CPython.