All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org, "John Snow" <jsnow@redhat.com>,
	armbru@redhat.com, qemu-devel@nongnu.org,
	"Max Reitz" <mreitz@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH v7 06/10] iotests: limit line length to 79 chars
Date: Sat, 07 Mar 2020 07:36:00 +0100	[thread overview]
Message-ID: <8736akzn73.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20200306101425.GC7240@linux.fritz.box> (Kevin Wolf's message of "Fri, 6 Mar 2020 11:14:25 +0100")

Kevin Wolf <kwolf@redhat.com> 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.



  parent reply	other threads:[~2020-03-07  6:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-04 21:38 [PATCH v7 00/10] iotests: use python logging John Snow
2020-03-04 21:38 ` [PATCH v7 01/10] iotests: do a light delinting John Snow
2020-03-04 21:45   ` Philippe Mathieu-Daudé
2020-03-04 22:43     ` John Snow
2020-03-04 21:38 ` [PATCH v7 02/10] iotests: don't use 'format' for drive_add John Snow
2020-03-04 21:38 ` [PATCH v7 03/10] iotests: ignore import warnings from pylint John Snow
2020-03-04 21:38 ` [PATCH v7 04/10] iotests: replace mutable list default args John Snow
2020-03-04 21:59   ` Philippe Mathieu-Daudé
2020-03-04 21:38 ` [PATCH v7 05/10] iotests: add pylintrc file John Snow
2020-03-04 21:38 ` [PATCH v7 06/10] iotests: limit line length to 79 chars John Snow
2020-03-04 21:58   ` Philippe Mathieu-Daudé
2020-03-04 23:14     ` John Snow
2020-03-05 11:55       ` Kevin Wolf
2020-03-05 18:25         ` John Snow
2020-03-06 10:14           ` Kevin Wolf
2020-03-06 18:34             ` John Snow
2020-03-07  6:36             ` Markus Armbruster [this message]
2020-03-04 21:38 ` [PATCH v7 07/10] iotests: add script_initialize John Snow
2020-03-04 21:38 ` [PATCH v7 08/10] iotest 258: use script_main John Snow
2020-03-04 21:38 ` [PATCH v7 09/10] iotests: Mark verify functions as private John Snow
2020-03-04 21:47   ` Philippe Mathieu-Daudé
2020-03-04 21:38 ` [PATCH v7 10/10] iotests: use python logging for iotests.log() John Snow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736akzn73.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.