Python Identifiers

by | Dec 21, 2020 | Python

Python Identifiers

Identifiers are used to identify variables, functions, classes, or other objects.  Some rules should be taken care of before naming the objects. These are:

  • The identifiers should start with A-Z or a-z or underscore (_) followed by letters or digits.
  • No other special character (e.g @, $, and %) is allowed.
  • As python is a case-sensitive language, Var and var are two different identifiers.
  • Class name should start with Uppercase.
  • Except class name, all other identifiers are advised to be in lowercase.
  • If the identifier starts with a single leading underscore, the identifier is considered to be private.
  • If the identifier starts with two leading underscores, the identifier is considered to be strongly private.
  • If the identifier ends with two trailing underscore, the identifier is considered to be a language-defined special name.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.