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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Fri, 23 Aug 2013 11:25:35 +0800,
Guannan Ren wrote:
> 
> 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@xxxxxxxxxx>
> > ---
> > 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

Thanks, pushed now.

Claudio
-- 
AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>

Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]