summaryrefslogtreecommitdiff
path: root/collect/bst.py
diff options
context:
space:
mode:
authorScott <[email protected]>2022-02-02 13:47:36 -0800
committerScott <[email protected]>2022-02-02 13:47:36 -0800
commit7ff2af6fe7bffea90dc4a31c93140c189917c659 (patch)
tree34cb138c3a572037b5bc1d1b52ad9d25a2604ccb /collect/bst.py
parent6ba90a1f30f1c0cf4df12fcd0c62181f29bc3668 (diff)
Let's be explicit with asserts; there was a bug in histogram
caused by assert foo when foo was an int with valid valid 0.
Diffstat (limited to 'collect/bst.py')
-rw-r--r--collect/bst.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/collect/bst.py b/collect/bst.py
index 9d65259..8602ce6 100644
--- a/collect/bst.py
+++ b/collect/bst.py
@@ -520,12 +520,12 @@ class BinarySearchTree(object):
return x
path = self.parent_path(node)
- assert path[-1]
+ assert path[-1] is not None
assert path[-1] == node
path = path[:-1]
path.reverse()
for ancestor in path:
- assert ancestor
+ assert ancestor is not None
if node != ancestor.right:
return ancestor
node = ancestor