[PATCH 4/9] Use "is" not "==" for None
From: Elisha Hollander
Date: Mon May 24 2021 - 11:13:55 EST
Using == is not always a good idea when dealing with None's, for example, if you have this class:
`class NotNone: __eq__ = lambda self, other: True`
Then NotNone()==None returns True
But NonNone() is None returns False
And PEP 8 says: "Comparisons to singletons like None should always be done with 'is' or 'is not', NEVER the equality operators."
---
tools/perf/scripts/python/exported-sql-viewer.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
index 7daa8bb70a5a..221f36c906da 100755
--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -445,7 +445,7 @@ class FindBar():
index = self.textbox.currentIndex()
data = self.textbox.itemData(index)
# Store the pattern in the combo box to keep it with the text value
- if data == None:
+ if data is None:
self.textbox.setItemData(index, pattern)
else:
self.pattern.setChecked(data)
--
2.25.1