From: Ben Pfaff Date: Tue, 23 Aug 2011 17:43:26 +0000 (-0700) Subject: ovs.jsonrpc: Use "not X" in place of "len(X) == 0" for testing strings. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ad4ef89208cf683859b1a269f3c5328a998c47d;p=openvswitch ovs.jsonrpc: Use "not X" in place of "len(X) == 0" for testing strings. Suggested-by: Reid Price --- diff --git a/python/ovs/jsonrpc.py b/python/ovs/jsonrpc.py index 1cc36964..1cc7fb7d 100644 --- a/python/ovs/jsonrpc.py +++ b/python/ovs/jsonrpc.py @@ -249,7 +249,7 @@ class Connection(object): return self.status, None while True: - if len(self.input) == 0: + if not self.input: error, data = self.stream.recv(4096) if error: if error == errno.EAGAIN: @@ -260,7 +260,7 @@ class Connection(object): % (self.name, os.strerror(error))) self.error(error) return self.status, None - elif len(data) == 0: + elif not data: self.error(EOF) return EOF, None else: @@ -321,7 +321,7 @@ class Connection(object): return msg def recv_wait(self, poller): - if self.status or len(self.input) > 0: + if self.status or self.input: poller.immediate_wake() else: self.stream.recv_wait(poller)