From: Simon Marchi <simon.marchi@polymtl.ca>
To: Lancelot SIX <lsix@lancelotsix.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Use is/is not to check for None in python.
Date: Tue, 8 Jun 2021 12:25:37 -0400 [thread overview]
Message-ID: <d86eea98-19e8-d406-96b2-1ed614f89dc3@polymtl.ca> (raw)
In-Reply-To: <YL7D+CMN7Jf+UmFQ@vapier>
On 2021-06-07 9:12 p.m., Mike Frysinger via Gdb-patches wrote:
> On 07 Jun 2021 23:50, Lancelot SIX via Gdb-patches wrote:
>> While reviewing a patch sent to the mailing list, I noticed there are few
>> places where python code checks if a variable is 'None' or not by using the
>> comparison operators '==' and '!='. PEP8[1], which is used as coding standard
>> in GDB coding standards, recommends using 'is' / 'is not' when comparing to a
>> singleton such as 'None'.
>
> this is correct, so all the changes look fine. but i wonder if we couldn't
> make many more pythonic by treating them as bools. for example:
The patch LGTM but I also agree with Mike. So Lancelot, if you want to
merge it as-is, that's fine. If you want to update it as suggested by
Mike, that's fine too.
Simon
next prev parent reply other threads:[~2021-06-08 16:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-07 22:50 Lancelot SIX
2021-06-08 1:12 ` Mike Frysinger
2021-06-08 16:25 ` Simon Marchi [this message]
2021-06-08 23:01 ` Lancelot SIX
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=d86eea98-19e8-d406-96b2-1ed614f89dc3@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=lsix@lancelotsix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).