Learning Python Part-7: Python Identifiers

As we discussed earlier, in python programming, we use Object Oriented Programming (OOP) extensively. So before we go ahead and start creating objects like variables, classes or functions, we need to understand few basic considerations about how to set identifiers. In other words, naming convention rules for objects.

  • Try to use names that helps to understand purpose of it in the code.
  • Identifiers can be a combination of letters (a to z) or (A to Z),digits (0 to 9), and an underscore _. 
  • An identifier cannot start with a digit. 
    • Invalid name example:  1variable
  • Keywords cannot be used as identifiers.
    • Python Keywords are reserved and connote be used as identifiers
  • We cannot use special symbols like !, @, #, $, % etc. in our identifier.
  • Identifier can be of any length.

Leave a Reply