Python Identifiers
Python Identifiers
It
helps in uniquely identifying these entities in a program. Here are the rules for creating identifiers in
Python:
Allowed Characters:
Reserved Words:
Avoid using Python keywords as identifiers, as they have special meanings. For example, if, else,
while, for, class, def, import, etc.
Special Identifiers:
Identifiers starting and ending with double underscores (__) are reserved for special use in Python.
For example, __init__ is used as a special method in classes.
Convention:
It's a convention to use lowercase names for functions and variables, and uppercase names for
classes. If an identifier name consists of multiple words, it's common to use underscores to separate
them (snake_case).