Our Python style is largely based on the PEP-8 standard. We have a few specific rules on top of that that we like to enforce.

<aside> ⚠️ Don't rely fully on pycodestyle

The pycodestyle (formerly pep8) tool does not necessarily enforce the right styles in all cases! Despite the name, it's not built solely to test against PEP-8 or our code style. It by default tests against what the author considers best practices, which do not always match our own style guidelines.


Whitespace / Line Rules

Line length

Many statements will require more than one line. For this, we prefer parenthesis for line continuation, rather than backslashes (in most cases — see below).

For example, if statements, for loops, etc. will use parenthesis:

# Yes:
if (some_long_function_call('that might take a whole line') and

For multi-line strings that won't fit on a single line, use parenthesis: