coding style guidelines
This commit is contained in:
parent
2efe45896b
commit
8ecd826e8a
|
@ -0,0 +1,30 @@
|
|||
# Copyright (c) 2006 Marcos Pinto ('markybob') <markybob@gmail.com>
|
||||
|
||||
This is pretty much taken straight out of PEP 8, the "Style Guide for Python
|
||||
Code" (http://www.python.org/dev/peps/pep-0008/)
|
||||
More or less, if you try to submit a patch that doesn't follow this guide, odds
|
||||
are your patch will be denied...unless it does some incredibly magnificient
|
||||
things, in which case I *might* edit it. Don't bet on it, though.
|
||||
|
||||
Here are the highlights:
|
||||
Indents are FOUR (4) spaces. Not 8, not 5 or 2 and definitely NOT tab.
|
||||
Limit all lines to a maximum of 79 characters.
|
||||
Use UTF-8 encoding
|
||||
Every single import should be on its own line
|
||||
Avoid extraneous whitespace in the following situations:
|
||||
Yes: spam(ham[1], {eggs: 2})
|
||||
No: spam( ham[ 1 ], { eggs: 2 } )
|
||||
Yes: spam(1)
|
||||
No: spam (1)
|
||||
Yes: if x == 4: print x, y; x, y = y, x
|
||||
No: if x == 4 : print x , y ; x , y = y , x
|
||||
Yes: dict['key'] = list[index]
|
||||
No: dict ['key'] = list [index]
|
||||
Yes:
|
||||
x = 1
|
||||
y = 2
|
||||
long_variable = 3
|
||||
No:
|
||||
x = 1
|
||||
y = 2
|
||||
long_variable = 3
|
Loading…
Reference in New Issue