Re: [PATCH] scripts/gdb: replace "is 0" by "== 0"

From: Vincent Bernat
Date: Fri Mar 20 2020 - 13:05:58 EST


â 20 mars 2020 16:47 +00, Kieran Bingham:

> Oh, I thought python encouraged the 'is' style.

Usually, only for "None", "False" or "True" (but for the latest, this
doesn't usually make sense).

> Given the nature of the statement, would
>
> if not node:
> return None
>
> be any more appropriate ?

It would be more consistent with the other uses (like the while below
and the ifs even further). However, I don't fully understand this code
(notably the "node = node.address.cast(...)" where node is not defined
yet and node is replaced by the value of "root['rb_node']" just after),
so can't say for sure node cannot be equal to something eveluating to
False in some conditions.
--
Writing is easy; all you do is sit staring at the blank sheet of paper until
drops of blood form on your forehead.
-- Gene Fowler