From d101d3bce8c59583c5713215b6a7fb2f7376a1fc Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Thu, 22 Aug 2013 11:16:03 +0200 Subject: Test for object identity when checking for None in Python 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. --- libvirt-override-virStream.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libvirt-override-virStream.py') diff --git a/libvirt-override-virStream.py b/libvirt-override-virStream.py index b5cec2a..53000da 100644 --- a/libvirt-override-virStream.py +++ b/libvirt-override-virStream.py @@ -5,7 +5,7 @@ except AttributeError: pass - if self._o != None: + if self._o is not None: libvirtmod.virStreamFree(self._o) self._o = None @@ -103,7 +103,7 @@ the request would block, integer -2 is returned. """ ret = libvirtmod.virStreamRecv(self._o, nbytes) - if ret == None: raise libvirtError ('virStreamRecv() failed') + if ret is None: raise libvirtError ('virStreamRecv() failed') return ret def send(self, data): -- cgit