Skip to content

Latest commit

 

History

History
34 lines (28 loc) · 1.01 KB

File metadata and controls

34 lines (28 loc) · 1.01 KB

PEP8 in a brief

Code Layout

  • 4 spaces for indentation
  • For hanging indents,align hirarchily
  • Limit line length to 79 chars
  • 2 blank lines for class and 1 for method
  • Use blank line as logical seperator within methods

Strings Quote

  • Single or double quote? it doesn't matter
  • Be consistent and stick to it

White Spaces

  • whitespace afre comma,semicolon and colon. Not BEFORE!!
  • use one space each for assigment(a = b). No to (a= b), (a =b), (a= b),(a =b)
  • Can use whitespaces as logical seperator (32 - 4),(43 + 7*8)
  • No space for default parameter assignment. def hello(name,msg="Hello")
  • One statement per line

Comments

  • blockcomment for all the code followed after
  • inline comments should express logical statements
  • Document string starts and ends with three double quoted chars

Naming things

  • CapWord convention for class (DoTheseThings)
  • lowercase for functions (def do_this():)
  • function parameters (def do_this(param_one,param_two):)

Programmming style practice