Python identifiers are unique names given to entities such as variables, functions, modules, classes, objects, and other elements. In other words, any name created by the user in a Python program is considered an identifier.
Table of Contents
Characteristics
1. Naming Rules: Rules to create any name
- Name can contain Alphabets, digits, and underscore
- Must start with a letter (a-z, A-Z) or an underscore (_).Cannot start with a digit.
- Cannot use a Python keyword as a name (e.g., if, while).
2. Case-Sensitivity
Identifiers are case-sensitive (std_name and STD_name are different variables).
3. Descriptive Names
It’s good practice to use work-related names that convey the purpose of the identifier.
4. Naming Conventions:
- Variable names: Use lowercase letters and underscores (e.g., user_age).
- Function names: Use lowercase letters and underscores (e.g., calculate_sum).Class names: Use CamelCase (e.g., EmployeeDetails).
- Constants: Use uppercase letters and underscores (e.g., MAX_COUNT).
Examples
# Valid identifiers
user_age = 25
calculate_sum = lambda x, y: x + y # will see more in upcoming concepts
class EmployeeDetails:
pass
MAX_COUNT = 100
# Invalid identifiers
1st_variable = 10 # Starts with a digit
variable-name = 20 # Contains a hyphen
if = 30 # Uses a keyword
Conclusion
Identifiers are crucial in Python as they represent names of the object which user creates. Following naming conventions and rules helps maintain code readability and consistency. Understanding these conventions and characteristics is essential for writing clear, maintainable Python code.
Knowledge Check

Check out our Trending Courses Demo Playlist
Data Analytics with Power Bi and Fabric |
Could Data Engineer |
Data Analytics With Power Bi Fabic |
AWS Data Engineering with Snowflake |
Azure Data Engineering |
Azure & Fabric for Power bi |
Full Stack Power Bi |
Most Commented