Skip to content

Style guidelines. #54

Description

@eyeonus

Indentation

  • Use 4 spaces per indentation level.

Suggested Maximum Line Length

  • Limit all lines to a maximum of 79 characters. Feel free to ignore if inconvenient.

Blank Lines

  • Blank lines must have the same indentation level as the immediately following non-blank line. This is an exception to the "No trailing whitespace" rule.

Whitespace in Expressions and Statements

Avoid extraneous whitespace in the following situations:

  • Immediately inside parentheses, brackets or braces.
    Yes: spam(ham[1], {eggs: 2})
    No:  spam( ham[ 1 ], { eggs: 2 } )
  • Between a trailing comma and a following close parenthesis.
    Yes: foo = (0,)
    No:  bar = (0, )
  • Immediately before a comma, semicolon, or colon:
    Yes: if x == 4: print x, y; x, y = y, x
    No:  if x == 4 : print x , y ; x , y = y , x
  • Immediately before the open parenthesis that starts the argument list of a function call:
    Yes: spam(1)
    No:  spam (1)
  • Immediately before the open parenthesis that starts an indexing or slicing:
    Yes: dct['key'] = lst[index]
    No:  dct ['key'] = lst [index]
  • More than one space around an assignment (or other) operator to align it with another.

    Yes:

    x = 1
    y = 2
    long_variable = 3
No:
    x             = 1
    y             = 2
    long_variable = 3

For everything else you might think of, refer to PEP8 as completely optional style advice except where it contradicts the above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidelineIndicates the audience for the "issue" is contributors and colloborators on the project.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions