Python Keywords
There is one more restriction on identifier names. The Python language reserves a small set of keywords that designate special language functionality. No object can have the same name as a reserved word.
In Python 3.6, there are 33 reserved keywords
You can see this list any time by typing help("keywords") to the Python interpreter. Reserved words are case-sensitive and must be used exactly as shown. They are all entirely lowercase, except for False, None, and True.
Trying to create a variable with the same name as any reserved word results in an error:
>>> for = 3
SyntaxError: invalid syntax
No comments:
Post a Comment