summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2013-03-05 06:17:57 (GMT)
committerRaymond Hettinger <python@rcn.com>2013-03-05 06:17:57 (GMT)
commit975a8e8f761d49e5ac4bfeb1168e79dc7c9c0f79 (patch)
tree825ff9ff1fb6603541e8b8ed5b582e9ad49233bf /Lib
parent221760a3aa89545bc15b126d6723bb037f6e612d (diff)
downloadcpython-975a8e8f761d49e5ac4bfeb1168e79dc7c9c0f79.zip
cpython-975a8e8f761d49e5ac4bfeb1168e79dc7c9c0f79.tar.gz
cpython-975a8e8f761d49e5ac4bfeb1168e79dc7c9c0f79.tar.bz2
Use LT in all comparisons
Diffstat (limited to 'Lib')
-rw-r--r--Lib/heapq.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/heapq.py b/Lib/heapq.py
index 82f61a2..6859821 100644
--- a/Lib/heapq.py
+++ b/Lib/heapq.py
@@ -181,7 +181,7 @@ def heapify(x):
def _heappushpop_max(heap, item):
"""Maxheap version of a heappush followed by a heappop."""
- if heap and heap[0] > item:
+ if heap and item < heap[0]:
item, heap[0] = heap[0], item
_siftup_max(heap, 0)
return item
@@ -312,7 +312,7 @@ def _siftdown_max(heap, startpos, pos):
while pos > startpos:
parentpos = (pos - 1) >> 1
parent = heap[parentpos]
- if newitem > parent:
+ if parent < newitem:
heap[pos] = parent
pos = parentpos
continue
@@ -329,7 +329,7 @@ def _siftup_max(heap, pos):
while childpos < endpos:
# Set childpos to index of larger child.
rightpos = childpos + 1
- if rightpos < endpos and not heap[childpos] > heap[rightpos]:
+ if rightpos < endpos and not heap[rightpos] < heap[childpos]:
childpos = rightpos
# Move the larger child up.
heap[pos] = heap[childpos]