Poodletooth-iLand/doc/style-guide/python-style.md
Master Jumblespeed d882959bfa switch to remote
2015-05-18 22:11:33 -04:00

1.3 KiB
Executable file

Python Style Guidelines

For Python programming, we use a slightly modified version of the standard PEP-8 Style Guide for Python Code. Read below for our modifications.


Code lay-out

Indentation

The closing brace/bracket/parenthesis on multi-line constructs may either be directly at the end, as in:

my_list = [
    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
    16, 17, 18, 19, 20]
result = some_function_that_takes_arguments(
    'a', 'b', 'c', 'd', 'e', 'f')

or it may be by itself on the next line:

my_list = [
    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
    16, 17, 18, 19, 20
]
result = some_function_that_takes_arguments(
    'a', 'b', 'c', 'd', 'e', 'f'
)

Tabs or Spaces?

Always use spaces.

Maximum Line Length

Docstrings and comments should be restricted to 80 characters. Anything else should be limited to 100 characters.

Naming Conventions

Variables

Intentionally unused variables should be named "_". This will make common IDEs and editors ignore it.

Strings

Quotations

Use single quotations (') unless there is one inside the string, in which case use double quotations (").