[Python-Dev] pep8 reasoning

Terry Reedy tjreedy at udel.edu
Sun Apr 27 22:28:20 CEST 2014


On 4/27/2014 3:34 PM, Chris Barker wrote:
> On Sun, Apr 27, 2014 at 9:40 AM, Barry Warsaw <barry at python.org
> <mailto:barry at python.org>> wrote:
>
>     On Apr 26, 2014, at 12:33 AM, Janzert wrote:
>
>      >So the one example under discussion is:
>      >foo = long_function_name(
>      >   var_one, var_two,
>      >   var_three, var_four)
>      >
>      >and comes from http://legacy.python.org/dev/peps/pep-0008/#indentation
>
>
> wow! just looked at that part of the PEP again, and that is a LOT of
> options. Is it impossible to come to any consensus on this? And as it
> happens, my favorite is not in there, though as far as I can tell not
> forbidden:

One arg per line is definitely permitted either when lining up with the 
first arg on the first line or with hanging indents.

> foo = long_function_name(var_one,
>                                            var_two,
>                                            var_three,
>                                            var_four)

In a fixed-pitch font, you have too many spaces for lines after the 
first. One advantage of hanging indent is that all arg lines have the 
same indent and thus the args line up regardless of the font. Hanging 
indents also give more space for default or named args and comments.

I would agree with having at least one example done with one arg per line.

-- 
Terry Jan Reedy



More information about the Python-Dev mailing list