Google News
logo
Python Keywords & Identifiers
Python keywords are special reserved words which convey a special meaning to the compiler/interpreter. In Python keywords are case sensitive each keyword have a special meaning and a specific operation. 

We cannot use a keyword as variable name, function name or any other identifier. They are used to define the syntax and structure of the Python language.

All the keywords except True, False and None are in lowercase and they must be written as it is. The list of all the keywords are given below.
Python Keywords
True break finally is return
False continue for lambda try
None except in raise pass
class def from nonlocal while
and del global not with
as elif if or  
assert else import yield

Testing for Python keywords

keyword.iskeyword(s)

      Return true if s is a Python keyword.

keyword.kwlist

      Sequence containing all the keywords defined for the interpreter. If any keywords are defined to only be active when particular __future__ statements are in effect, these will be included as well.

Python Identifiers

Python Identifier are the names given to the fundamental building blocks in a program. Like class, object, variables, functions, lists, dictionaries etc. in Python. It helps differentiating one entity from another.

1. Identifiers can be a combination of letters in lowercase (a to z) or uppercase (A to Z) or digits (0 to 9).

2. No special character except underscore ( _ ) can be used as an identifier.

3. We cannot use special symbols like !, @, #, $, % etc. in our identifier.

4. Keyword should not be used as an identifier name.

5. Python is a case-sensitive language. This means, Variable and variable are not the same. Always name identifiers that make sense.

6. First character of an identifier can be character, underscore ( _ ) but not digit.

7. Multiple words can be separated using an underscore ( this_is_free_time_learning ).