google / yapf

A formatter for Python files
Apache License 2.0
13.76k stars 890 forks source link

Allow function call parameters to be on different lines #193

Open PLPeeters opened 9 years ago

PLPeeters commented 9 years ago

I couldn't find a style option to allow function call parameters to be on different lines.

For instance:

foo(very_long_parameter_1,
    very_long_parameter_2,
    very_long_parameter_3)

Gets changed to:

foo(very_long_parameter_1, very_long_parameter_2, very_long_parameter_3)

I think this use case is common enough to justify a style option. Thoughts?

bwendling commented 9 years ago

I'm not opposed to the idea of adding this as an option. It can help in cases where the heuristics fail. I'll add this as an enhancement.

jorisvandenbossche commented 8 years ago

Related to this, but a little bit the opposite, code like this:

    def __init__(self, values, categories=None, ordered=False, name=None,
                 fastpath=False, levels=None):
        pass

gets reformatted as

    def __init__(self,
                 values,
                 categories=None,
                 ordered=False,
                 name=None,
                 fastpath=False,
                 levels=None):
        pass

Is there a way to configure yapf to prefer the first? (it's within 79 chars line length limit)