Python – forbidden variable names


To find out which names cannot be given to variables in Python, use the command:

import keyword
keyword.kwlist

For Python 3.6 this words are:

[‘False’,
‘None’,
‘True’,
‘and’,
‘as’,
‘assert’,
‘break’,
‘class’,
‘continue’,
‘def’,
‘del’,
‘elif’,
‘else’,
‘except’,
‘finally’,
‘for’,
‘from’,
‘global’,
‘if’,
‘import’,
‘in’,
‘is’,
‘lambda’,
‘nonlocal’,
‘not’,
‘or’,
‘pass’,
‘raise’,
‘return’,
‘try’,
‘while’,
‘with’,
‘yield’]


This entry was posted in Python (en). Bookmark the permalink.

Leave a Reply

🇬🇧 Attention! Comments with URLs/email are not allowed.
🇷🇺 Комментарии со ссылками/email удаляются автоматически.