[Python-ideas] Minor tweak to PEP 8?

Gregory P. Smith greg at krypto.org
Sat May 14 20:51:37 CEST 2011


On Wed, May 11, 2011 at 7:23 AM, Guido van Rossum <guido at python.org> wrote:
> At Google we use the following rule (from
> http://google-styleguide.googlecode.com/svn/trunk/pyguide.html#Indentation):
>
> Yes:  # Aligned with opening delimiter
>       foo = long_function_name(var_one, var_two,
>                                var_three, var_four)
>
>       # 4-space hanging indent; nothing on first line
>       foo = long_function_name(
>           var_one, var_two, var_three,
>           var_four)

and note that this should be "8-space hanging indent" if it goes into
pep8.  The rule is really "double your code indentation hanging
indent" so that you can never confuse the two visually.  it works
well.

>
> No:   # Stuff on first line forbidden
>       foo = long_function_name(var_one, var_two,
>           var_three, var_four)
>
>       # 2-space hanging indent forbidden
>       foo = long_function_name(
>         var_one, var_two, var_three,
>         var_four)
>
> I propose we somehow incorporate these two allowed alternatives into PEP 8.
> They both serve a purpose.
>
> --
> --Guido van Rossum (python.org/~guido)
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
>



More information about the Python-ideas mailing list