[Python-Dev] pep8 reasoning
Chris Barker
chris.barker at noaa.gov
Sun Apr 27 21:34:33 CEST 2014
On Sun, Apr 27, 2014 at 9:40 AM, Barry Warsaw <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:
foo = long_function_name(var_one,
var_two,
var_three,
var_four)
That is, I find that if the argument list is too long for one line, then
splitting it out to only one argument per line is much more readable to me.
This becomes more important with default parameters:
foo = long_function_name(var_one,
var_two=a_value,
var_three=some_other_value,
var_four=(a, tuple, of, values)
)
as with more information in each argument, it's a lot more clear where one
starts and the other begins. And it provides a nice place for comments:
foo = long_function_name(var_one,
var_two=a_value, # because
default doesn't frobnicate in this case
var_three=some_other_value,
var_four=(a, tuple, of, values)
)
Anyway -- is there a point in trying to standardize this a bit more in
PEP8, or has that battle long since been fought and conceded ?
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140427/f610e7f4/attachment.html>
More information about the Python-Dev
mailing list