In this tutorial, we are going to discuss about Identifiers in Python. A Name in Python Program is called Identifier. It can be Class Name Or Function Name Or Module Name Or Variable Name.


num = 10
Rules to define Identifiers in Python
  • The only allowed characters in Python are
    1. Alphabet symbols (either lower case or upper case)
    2. digits(0 to 9)
    3. underscore symbol(_)
    4. By mistake if we are using any other symbol like $ then we will get syntax error.
  • Identifier should not starts with digit.
  • Identifiers are case sensitive. Of course Python language is case sensitive language.

1. Alphabet Symbols (Either Upper case OR Lower case)
2. If Identifier is start with Underscore (_) then it indicates it is private.
3. Identifier should not start with Digits.
4. Identifiers are case sensitive.
5. We cannot use reserved words as identifiers
E.g def = 10
6. There is no length limit for Python identifiers. But not recommended to use too lengthy identifiers.
7. Dollar ($) Symbol is not allowed in Python.
8. If identifier starts with _ symbol then it indicates that it is private
9. If identifier starts with __(Two Under Score Symbols) indicating that strongly private identifier.
10. If the identifier starts and ends with two underscore symbols then the identifier is language defined special name, which is also known as magic methods.

That’s all about the Identifiers in Python programming language. If you have any queries or feedback, please write us email at Enjoy learning, Enjoy Python language.!!

Scroll to top