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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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