Python Identifiers

User defined program in a program is called Identifiers.

  A Python identifier is a name used to identify a variable, function, class, module or other object.

Rules to defined Identifiers in python

There are certain rules defined for naming i.e., Identifiers.

myvariable =10  #valid
596abc=50 #invalid
_var=56 #valid

  An Identifier can be combination of alphabets and digits but It can not start from digit .

  An identifier is a long sequence of characters and numbers.

  No special character except underscore ( _ ) can be used in identifiers.

  Keyword should not be used as an identifier name.

  Python is case sensitive.Thus, python and Python are two different identifiers in Python.

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


Here are naming conventions for Python identifiers

  Starting an identifier with a single leading underscore indicates that the identifier is private.

  Starting an identifier with two leading underscores indicates a strong private identifier.

  Class names start with an uppercase letter. All other identifiers start with a lowercase letter.

  If the identifier also ends with two trailing underscores, the identifier is a language-defined special name.