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’]