Coding style - keep parentheses on the same line or new line?

coding-style, formatting, python, readability

Solution

I'd probably do:

return render(
    request, 
    template,
    {
        'var1' : value1,
        'var2' : value2,
        'var3' : value3
    }
)

I would keep the bracket on the same line, so that searches for `render(` work. And because I find it clearer. But I'd put all the arguments on new lines.

Problem

Suppose you are calling a function, where there's clearly a need to break down the statement into few lines, for readability's sake. However there are at least two way to do it: Would you do this: ``` return render(request, template, { 'var1' : value1, 'var2' : value2, 'var3' : value3 } ) ``` Or would you rather do that: ``` return render \ ( request, template, { 'var1' : value1, 'var2' : value2, 'var3' : value3 } ) ``` Or, please suggest your own formatting. Please also list reasons why would you use a particular formatting and what's wrong with the other one. Thanks

Original source