Skip to content

Commit

Permalink
tools/kvm_stat: avoid 'is' for equality checks
Browse files Browse the repository at this point in the history
Use '==' for equality checks and 'is' when comparing identities.

An example where '==' and 'is' behave differently:
>>> a = 4242
>>> a == 4242
True
>>> a is 4242
False

Signed-off-by: Marc Hartmayer <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
Marc Hartmayer authored and bonzini committed Feb 24, 2018
1 parent 0eb5780 commit 369d5a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/kvm/kvm_stat/kvm_stat
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ class Tui(object):
stats = self.stats.get(self._display_guests)
total = 0.
for key, values in stats.items():
if key.find('(') is -1:
if key.find('(') == -1:
total += values.value

if self._sorting == SORT_DEFAULT:
Expand All @@ -1110,7 +1110,7 @@ class Tui(object):
self.screen.addstr(row, 1, '%-40s %10d%7.1f %8s' %
(key, values.value, values.value * 100 / total,
cur))
if cur is not '' and key.find('(') is -1:
if cur != '' and key.find('(') == -1:
tavg += cur
row += 1
if row == 3:
Expand Down

0 comments on commit 369d5a8

Please sign in to comment.