# Aligned with opening delimiter. foo = long_function_name(var_one, var_two, var_three, var_four) # More indentation included to distinguish this from the rest. def long_function_name( var_one, var_two, var_three, var_four): print(var_one) # Hanging indents should add a level. foo = long_function_name( var_one, var_two, var_three, var_four)
my_list = [
1, 2, 3,
4, 5, 6,
]
result = some_function_that_takes_arguments(
‘a‘, ‘b‘, ‘c‘,
‘d‘, ‘e‘, ‘f‘,
)
顶级函数和类定义上下使用两个空行分隔。类内的方法定义使用一个空行分隔。
UTF-8编码(或者在 Python 2 中使用ASCII)。import不同的模块应该独立一行->左右各插入一个空格。原文:https://www.cnblogs.com/moxianghuibi/p/11368649.html