Florent Xicluna added the comment:

According to the documentation, the reserved words are classified as 
identifiers:
http://docs.python.org/3/reference/lexical_analysis.html#keywords

There's an easy workaround:

>>> from keyword import iskeyword
>>> def is_valid_identifier(s):
...     return s.isidentifier() and not iskeyword(s)
... 
>>> is_valid_identifier('def')
False

----------
nosy: +flox

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17447>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to