New submission from W deW: An identifier is defined by
identifier ::= (letter|"_") (letter | digit | "_")* setattr accepts identifiers that do not meet this criterion: <pre> Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> class C(object): pass ... >>> o=C() >>> setattr(o, "$$$", True) >>> dir(o) ['$$$', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__in module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__su __', '__weakref__'] >>> o.$$$ File "<stdin>", line 1 o.$$$ ^ SyntaxError: invalid syntax >>> </pre> ---------- components: Interpreter Core messages: 251248 nosy: W deW priority: normal severity: normal status: open title: setattr accepts invalid identifiers type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25205> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com