[Python-Dev] pep8 reasoning

Steven D'Aprano steve at pearwood.info
Mon Apr 28 03:34:57 CEST 2014


On Sun, Apr 27, 2014 at 04:28:20PM -0400, Terry Reedy wrote:
> 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.
[...]
> I would agree with having at least one example done with one arg per line.

Is it really necessary? I think that one-arg-per-line is an obvious 
variation of the existing example.

If the only example given was one-arg-per-line, then the reader might 
wrongly assume that *only* one arg was allowed. But since the example 
shows more than one arg per line (two in the above example), I expect 
that people will read it as "some arbitrary number" rather than "exactly 
two". So I don't think there's any need to show yet another example, 
especially since it's just a variation on the existing examples.



-- 
Steven


More information about the Python-Dev mailing list