Python conventions
Variable names
Variables names are in lower case with underscores used to separate words, as needed.
Constant names
Constant names are in upper case with underscores used to separate words, as needed.
Indentation in function definitions
Indent four spaces in the body of a function definition.
Separation of functions
Separate functions with blank lines.
Line length
Restrict lines to 79 characters. Use a backslash to continue a line.
Docstrings for functions
A docstring in Python is put right after the function header. Multiple lines are fine. Use three double quotes to start and end.
Indentation in while loops
Indent four spaces in the body of a while loop.
Indentation in for loops
Indent four spaces in the body of a for loop.
Separation of class headers and docstrings
Put a blank line between a class header and the docstring for the class.
Docstrings for classes
In the docstring for the class, give the summary, list methods, and list attributes.
Docstrings for methods
Docstrings for methods are like docstrings for functions.
Separation of docstrings and methods
Put blank lines between the docstring for the class and the methods.
Class names
Capitalize class names.
Method names
The conventions for method names are the same as those for function names.