<div dir="ltr"><div>Hello,</div><div><br></div><div>In the Code lay-out\Indentation section of PEP8 it is stated that</div><div><br></div><div>"<p>
     The closing brace/bracket/parenthesis on multi-line constructs may
either line up under the first non-whitespace character of the last
line of list, as in:
</p><p>    </p>
    <pre class="literal-block">my_list = [
    1, 2, 3,
    4, 5, 6,
    ]</pre><pre class="literal-block">result = some_function_that_takes_arguments(
    'a', 'b', 'c',
    'd', 'e', 'f',
    )</pre><pre class="literal-block"></pre>
    <p>
     or it may be lined up under the first character of the line that
starts the multi-line construct, as in:
</p><p>    </p>
    <pre class="literal-block">my_list = [
    1, 2, 3,
    4, 5, 6,
]</pre><pre class="literal-block">result = some_function_that_takes_arguments(
    'a', 'b', 'c',
    'd', 'e', 'f',
)</pre><pre class="literal-block">"
</pre></div><div><br></div><div>however, right before that location, there are several examples that do not comply, like these:</div><div><br></div><div>"</div><div><pre class="literal-block"># 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)</pre></div><div>"</div><div><br></div><div>That should be corrected but it isn't the main point of this topic.</div><div><br></div><div><br></div><div>Assuming that a multi-line function definition is considered a multi-line construct, I would like to propose an exception to the closing brace/bracket/parenthesis indentation for multi-line constructs rule in PEP8.</div><div><br></div><div>I my view all multi-line function definitions should only be allowed options "usual" and "acceptable" shown below, due to better readability.</div><div><br></div><div><br></div><div>I present 3 examples (usual, acceptable, horrible) where only the last 2 comply with the current existing rule:</div><div><br></div><div><font face="courier new,monospace">def do_something(parameter_one, parameter_two, parameter_three, parameter_four,<br>                 parameter_five, parameter_six, parameter_seven,<br>                 last_parameter):<br>    """Do something."""<br>    pass</font></div><div><font face="courier new,monospace"><br></font></div><div><font face="courier new,monospace">def do_something(parameter_one, parameter_two, parameter_three, parameter_four,<br>                 parameter_five, parameter_six, parameter_seven, last_parameter<br>                 ):<br>    """Do something."""<br>    pass</font></div><div><font face="courier new,monospace"><br></font></div><div><font face="courier new,monospace">def do_something(parameter_one, parameter_two, parameter_three, parameter_four,<br>                 parameter_five, parameter_six, parameter_seven, last_parameter<br>):<br>    """Do something."""<br>    pass</font></div><div><br></div><div><br></div><div>The same 3 examples in the new 3.5 typing style:</div><div><br><font face="courier new,monospace">def do_something(parameter_one: List[str], parameter_two: List[str],<br>                 parameter_three: List[str], parameter_four: List[str],<br>                 parameter_five: List[str], parameter_six: List[str],<br>                 parameter_seven: List[str],<br>                 last_parameter: List[str]) -> bool:<br>    """Do something."""<br>    pass</font></div><div><font face="courier new,monospace"><br></font></div><div><font face="courier new,monospace">def do_something(parameter_one: List[str], parameter_two: List[str],<br>                 parameter_three: List[str], parameter_four: List[str],<br>                 parameter_five: List[str], parameter_six: List[str],<br>                 parameter_seven: List[str], last_parameter: List[str]<br>                 ) -> bool:<br>    """Do something."""<br>    pass</font></div><div><font face="courier new,monospace"><br></font></div><div><font face="courier new,monospace">def do_something(parameter_one: List[str], parameter_two: List[str],<br>                 parameter_three: List[str], parameter_four: List[str],<br>                 parameter_five: List[str], parameter_six: List[str],<br>                 parameter_seven: List[str], last_parameter: List[str]<br>) -> bool:<br>    """Do something."""<br>    pass</font></div><div><br></div><div><br></div><div><br></div><div>Best regards,</div><div><br></div><div>JM</div><div><br></div></div>