Python Naming Conventions
Links: 108 Python Index
Naming Conventions¶
- Camel Case:
myVariableName- Used in Java, JavaScript and other programming languages
- Not used in Python.
- Snake Case:
my_variable_nameormy_function_name- Used in python to name variables and functions.
- Pascal Case:
MyClassName- Also known as Capital Camel Case
- Used to name classes in python.
- Kebab Case:
some-package-name- Also known as Lisp case or caterpillar case
- Generally you will see this kind of naming convention while installing packages using pip.
pip install opencv-pythonorpip install scikit-learn
- We install packages in Kebab case but import them using snake case
- Upper Snake Case:
SOME_CONSTANT_VARIABLE- Used to define constants in python.
- Flat Case:
myvariablename- Leads to NOT so readable names.
- Cobol Case:
MY-VARIABLE-NAME
Last updated: 2023-01-21