Python Identifiers

Table of Contents

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.

Author

  • Barry Allen

    A Full Stack Developer with 10+ years of experience in different domain including SAP, Blockchain, AI and Web Development.

    View all posts

Comments

Leave a Reply

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.