Skip to content
Łukasz Langa edited this page Jan 12, 2017 · 7 revisions

Python conventions

Follow PEP 8.

We use the flake8 linter to enforce style rules. This greatly simplifies code reviews.

Exceptions:

  • We use 99 characters as the maximum line length.
  • Use spaces around = signs in default parameter values in functions with annotations:
def f(x: int = 1) -> None: ...  # OK, since f is annotated

def f(x=1) -> None: ...         # OK, fall back to PEP 8 if there is no annotation

Stub conventions

Stubs mostly follow Python conventions (see above). We use some modified conventions, mostly to make stubs more compact. See the typeshed coding style for details.