contact@eeehub.in +919470012104

Python Identifiers

Python Identifiers: Identifier is the name used to identify a variables, class, modules, function and other object of python. As you identify by your name. For example this website is identify by name "EEEHUB".

There are some conversion or rules you need to follow while naming the objects of the python programming language. These conversion will also help you to understand the code of other python developers. So, let see them one by one.


  1. First letter of the name should be letter from (a to z) or (A to Z) or underscore (_) followed by letters, digits(0-9). Remember: No special character(s) are allowed except underscore.
    Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
    Type "copyright", "credits" or "license()" for more information.
    >>> 9A = "Hello World"
    SyntaxError: invalid syntax
    >>> _A = "Hello World"
    >>> print(_A)
    Hello World
  2. Python is case sensitive programming language. It means for python language EEEHUB and eeehub will be different identifiers.
    >>> EEEHUB = "First Identifier"
    >>> eeehub = "Second Identifier"
    >>> print(EEEHUB)
    First Identifier
    >>> print(eeehub)
    Second Identifier
  3. Class names start with an uppercase letter. All other identifiers start with a lowercase letter for example: Users (It is perfect class name.)
    >>> class User:
    print("User class")
  4. Starting an identifier with a single leading underscore indicates that the identifier is private for example: _userage (You have to understand that this is private identifier.)
  5. Starting an identifier with two leading underscores indicates a strong private identifier for example: __userpassword(strong private identifier)
  6. If the identifier also ends with two trailing underscores, the identifier is a language defined special name for example: __add__
  7. Reserves word can't be used for identifier for example print(). print is a reserve word in python language.