Coding Style Guidelines
PEP 8 — the Style Guide for Python Code
Recommendations
Spaces vs TAB
indentation: recommended 4 spaces
Code layout
79 characters per line
surround top-level functions and classes with two blank lines
surround method definitions inside classes with a single blank line
use blank lines inside functions to show clear steps.
Comments
block and inline comments: start each line with a # followed by a single space
Whitespace in Expressions and Statements
surround binary operators and multiple conditions statements with a single space
PEP 257 – Docstring Conventions
Recommendations
Surround docstrings with three double quotes on either side:
"""This is a docstring"""Write them for all public modules, functions, classes, and methods.
Put the
"""that ends a multiline docstring on a line by itself:"""Solve quadratic equation via the quadratic formula. A quadratic equation has the following form: ax**2 + bx + c = 0 """
Google Python Style Guide
Covers coding and docstring style
NumPy Python Code Documentation
Focus on doctring style