Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6681de2

Browse files
committed
_siftup(): __le__ is now the only comparison operator used on array
elements.
1 parent 0ad679f commit 6681de2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/heapq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def _siftup(heap, pos):
233233
while childpos < endpos:
234234
# Set childpos to index of smaller child.
235235
rightpos = childpos + 1
236-
if rightpos < endpos and heap[rightpos] < heap[childpos]:
236+
if rightpos < endpos and heap[rightpos] <= heap[childpos]:
237237
childpos = rightpos
238238
# Move the smaller child up.
239239
heap[pos] = heap[childpos]

0 commit comments

Comments
 (0)