[libvirt] [PATCH] Test for object identity when checking for None in Python

Guannan Ren gren at redhat.com
Fri Aug 23 03:25:35 UTC 2013


On 08/22/2013 09:56 PM, Claudio Bley wrote:
> Consistently use "is" or "is not" to compare variables to None,
> because doing so is preferrable, as per PEP 8
> (http://www.python.org/dev/peps/pep-0008/#programming-recommendations):
>
>> Comparisons to singletons like None should always be done with is or
>> is not, never the equality operators.
> Signed-off-by: Claudio Bley <cbley at av-test.de>
> ---
> Purely mechanical change, using:
>
> find . -name '*.py' -exec sed -i -e 's,[ \t][ \t]*!=[ \t][ \t]*None, is not None,g' '{}' \+
> find . -name '*.py' -exec sed -i -e 's,[ \t][ \t]*==[ \t][ \t]*None, is None,g' '{}' \+

This change makes sense.
ACK

Guannan




More information about the libvir-list mailing list