qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 06/10] iotests: limit line length to 79 chars


From: Markus Armbruster
Subject: Re: [PATCH v7 06/10] iotests: limit line length to 79 chars
Date: Sat, 07 Mar 2020 07:36:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Kevin Wolf <address@hidden> writes:

> Am 05.03.2020 um 19:25 hat John Snow geschrieben:
[...]
>> So in summary:
>> 
>> - Avoid nested hanging indents from format operators
>> - Use a line break before the % format operator.
>> - OPTIONALLY(?), use a hanging indent for the entire format string to
>> reduce nesting depth.
>
> Yes, though I don't think of it as a special case for format strings. So
> I would phrase it like this:
>
> - Don't use hanging indent for any nested parentheses unless the outer
>   parentheses use hanging indents, too.
> - Use a line break before binary operators.
> - OPTIONALLY, use a hanging indent for the top level(s) to reduce
>   nesting depth.
>
> The first one is the only rule that involves some interpretation of
> PEP-8, the rest seems to be its unambiguous recommendation.
>
> Anyway, so I would apply the exact same rules to the following (imagine
> even longer expressions, especially the last example doesn't make sense
> with the short numbers):
>
> * bad:
>     really_long_function_name(-1234567890 + 987654321 * (
>         1337 / 42))

Definitely bad.

> * ok:
>     really_long_function_name(-1234567890 + 987654321
>                               * (1337 / 42))
>
> * ok:
>     really_long_function_name(
>         -1234567890 + 987654321
>         * (1337 / 42))

Yup.

> * ok:
>     really_long_function_name(
>         -1234567890 + 987654321 * (
>             1337 / 42))

Okay, although when you need this, chances are there's just too much
going on in that argument list.

>> e.g., either this form:
>> (using a line break before the binary operator and nesting to the
>> argument level)
>> 
>> write('hello %s'
>>       % (world,))
>> 
>> 
>> or optionally this form if it buys you a little more room:
>> (using a hanging indent of 4 spaces and nesting arguments at that level)
>> 
>> write(
>>     'hello %s'
>>     % ('world',))
>> 
>> 
>> but not ever this form:
>> (Using a hanging indent of 4 spaces from the opening paren of the format
>> operand)
>> 
>> write('hello %s' % (
>>     'world',))
>> 
>> 
>> 
>> yea/nea?
>> 
>> (Kevin, Philippe, Markus, Max)
>
> Looks good to me.

Me too.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]