x

Python Identifiers

PREV     NEXT

Python Identifiers:

Identifier is nothing but distinguish the variables, object, class, functions, etc. It helps differentiating one from another.


Rules for writing identifiers:

  • Identifiers can be combination of letters like lower (a-z), upper letters (A-Z),digits ( 0-9) and special character ‘_’

Example:

addClass , object_1,Order ,is_Valid etc

  • An identifier can’t start with a number

Ex:

  • 1variable #is invalid

    Variable1 #valid


  • Python scripting is a case sensitive scripting language i.e abc, ABC is different
  • identifiers length can be also long but preferred identifier name should be short and meaningful
  • We can’t use keywords as identifiers

Ex:

if =1, else=0 etc

  • Combination of special characters or symbols can’t be used as identifiers.

Ex:

@var, #name=2 etc

PREV     NEXT



Like it? Please Spread the word!