Add rules for indenting continuation lines.
This commit is contained in:
parent
0abda1e625
commit
848640dd6b
23
pep-0008.txt
23
pep-0008.txt
|
@ -57,6 +57,29 @@ Code lay-out
|
|||
For really old code that you don't want to mess up, you can continue to
|
||||
use 8-space tabs.
|
||||
|
||||
Continuation lines should align wrapped elements either vertically using
|
||||
Python's implicit line joining inside parentheses, brackets and braces,
|
||||
or using a hanging indent of double your code indention, in which case
|
||||
there should be no argument on the first line. For example:
|
||||
|
||||
Yes: # Aligned with opening delimiter
|
||||
foo = long_function_name(var_one, var_two,
|
||||
var_three, var_four)
|
||||
|
||||
# Double code indention for hanging indent; nothing on first line
|
||||
foo = long_function_name(
|
||||
var_one, var_two, var_three,
|
||||
var_four)
|
||||
|
||||
No: # Stuff on first line forbidden
|
||||
foo = long_function_name(var_one, var_two,
|
||||
var_three, var_four)
|
||||
|
||||
# 2-space hanging indent forbidden
|
||||
foo = long_function_name(
|
||||
var_one, var_two, var_three,
|
||||
var_four)
|
||||
|
||||
Tabs or Spaces?
|
||||
|
||||
Never mix tabs and spaces.
|
||||
|
|
Loading…
Reference in New Issue