The defining step for such issues is PEP 8 . PEP 8 gives you the freedom to break anywhere wherever you want (provided that you crash after the binary operator and use the implied continuation of the line in brackets). Whenever you break a row, usually the next row starts in the column after opening the parenthesis:
def func_with_lots_of_args(arg1, arg2, arg3, arg4, arg5):
My personal style is trying to arrange things so that the material in each line after the break is about the same length.
def func(arg1, arg2, arg3, arg4, arg5, arg6, kwd='foobar'):
but not:
def func(arg1, arg2, arg3, arg4, arg5, arg6, kwd='foobar'):
Although PEP8 doesn't really say you need to do it this way.
As a side note, if you have a function with many positional arguments, you should probably rethink your program design.
source share