From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: Marco Liebel <quic_mliebel@quicinc.com>,
qemu-devel@nongnu.org, Taylor Simpson <tsimpson@quicinc.com>,
John Snow <jsnow@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Cleber Rosa <crosa@redhat.com>,
Wainer dos Santos Moschetta <wainersm@redhat.com>,
Beraldo Leal <bleal@redhat.com>
Subject: Re: [PATCH] Use f-strings in python scripts
Date: Wed, 15 Mar 2023 11:16:01 +0000 [thread overview]
Message-ID: <ZBGo8WNlnRZUGYJZ@redhat.com> (raw)
In-Reply-To: <c05ddbd3-8f26-5492-3961-7f3d564373d7@linaro.org>
On Wed, Mar 15, 2023 at 08:43:33AM +0100, Philippe Mathieu-Daudé wrote:
> Hi Marco,
>
> (+Python experts)
>
> On 13/3/23 18:25, Marco Liebel wrote:
> > Replace python 2 format string with f-strings
> >
> > Signed-off-by: Marco Liebel <quic_mliebel@quicinc.com>
> > ---
> > target/hexagon/gen_helper_funcs.py | 54 ++--
> > target/hexagon/gen_helper_protos.py | 10 +-
> > target/hexagon/gen_idef_parser_funcs.py | 8 +-
> > target/hexagon/gen_op_attribs.py | 4 +-
> > target/hexagon/gen_op_regs.py | 10 +-
> > target/hexagon/gen_opcodes_def.py | 2 +-
> > target/hexagon/gen_printinsn.py | 14 +-
> > target/hexagon/gen_shortcode.py | 2 +-
> > target/hexagon/gen_tcg_func_table.py | 2 +-
> > target/hexagon/gen_tcg_funcs.py | 317 +++++++++++-------------
> > target/hexagon/hex_common.py | 4 +-
> > 11 files changed, 198 insertions(+), 229 deletions(-)
>
> These files use a mix of ', " and '''... Since you are modifying
> them, it would be nice to unify. I'm not sure there is a recommended
> style; matter of taste, I find the single quote (') less aggressive,
> then escaping it using ", and keeping ''' for multi-lines strings.
FWIW, rather than debating code style issues and coming up with a custom
set of rules for QEMU python code, my recommendation would be to consider
adopting 'black'
https://black.readthedocs.io/en/stable/
There is a trend with recent languages to offer an opinionated code
formatting tool as standard to maximise consistency across projects
in a given language. 'black' is a decent attempt to bring this to
the python world. I found it pretty liberating when doing recent
python work in libvirt, to be able to mostly not worry about formatting
anymore.
The main downside is the bulk-reformat in the history, which can
make backports more challenging. For "git blame" you can use the
.git-blame-ignore-revs file to hide the reformats.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2023-03-15 11:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 17:25 [PATCH] Use f-strings in python scripts Marco Liebel
2023-03-14 17:53 ` Taylor Simpson
2023-03-14 20:43 ` Marco Liebel
2023-03-15 7:43 ` Philippe Mathieu-Daudé
2023-03-15 11:16 ` Daniel P. Berrangé [this message]
2023-03-15 12:13 ` Philippe Mathieu-Daudé
2023-03-15 23:40 ` John Snow
2023-03-16 6:07 ` Markus Armbruster
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=ZBGo8WNlnRZUGYJZ@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=bleal@redhat.com \
--cc=crosa@redhat.com \
--cc=jsnow@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quic_mliebel@quicinc.com \
--cc=tsimpson@quicinc.com \
--cc=wainersm@redhat.com \
/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.