Python Programming/Naming conventions
Jump to navigation
Jump to search
There are various naming conventions used in Python programs.
PEP 0008 specifies naming conventions for class names (e.g. GenericTree), package and module names (e.g. generictree and generic_tree), function and variable names (storestate or store_state; mixedCase is dispreferred), and more. Google Python Style Guide follows similar naming conventions.
The above stands in contrast to Java naming convention (e.g. storeState for method names) and C# naming convention (e.g. StoreState for method names).
In Python 2, the standard library contains multiple deviations from PEP 0008. For instance, Tkinter module is spelled as Tkinter with capital T; this was renamed to tkinter in Python 3.
External links
[edit | edit source]- Naming Conventions in PEP 0008: Style Guide for Python Code, python.org
- Naming in Google Python Style Guide, google.github.io
- pycodestyle - Python style guide checker, pypi.python.org
- Modules to Rename in PEP 3108, python.org
- W:Naming convention (programming)