Python Conventions
General formatting and coding
- Python uses spaces, in fact use 4-space indentation, and no tabs.
- Wrap lines so that they don’t exceed 79 characters.
- Use blank lines to separate functions and classes, and larger blocks of code inside functions.
- Generally: use
PascaleCase
for class names andsnake_case
for functions and method defs. Always useself
as the name for the first argument of class methods. - Use docstrings.
- Use spaces around operators and after commas, but not directly inside bracketing constructs: a = f(1, 2) + g(3, 4).
Last modified: