For Markdown, use the Google style.
Keep line width under 80 chars. Break a line on a first syntactic structure, prefer hanging indent of 4 spaces over vertical alignment. Prefer parentheses for line joining over \. For JSON-like nested dicts and lists it's acceptable to use 2 space indent.
Yes:
str = (
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam diam met, '
'tristique ac placerat sit amet: %s, %s' % (a, b))
func_call(
param1=...,
param2=...,
param3=...)
like_json = {
'key': {
'a': {
'b': 123,
'c': 123,
'd': 123,
},
},
}
No:
str = \
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam diam met, '
str = ('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam diam '
'met, ....')
func_call(param1=...,
param2=...,
param3=...)
fun_call(param1=..., param2=...,
param3=...)
from X import Y statements, then import X statements within a single blockSeparations:
<import block of stdlib> <import block of import sys.path hack, e.g. test_env. Needed for now> <import block of appengine lib> <import block of appengine third_party lib, e.g. webapp2, or in third_party/> <import block of components and other application external libs> <import block of application libs>