Skip to content

Commit d7d4a05

Browse files
authored
Update: usage doc for heappushpop (GH-91451)
1 parent a573cb2 commit d7d4a05

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Lib/heapq.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
item = heappop(heap) # pops the smallest item from the heap
1313
item = heap[0] # smallest item on the heap without popping it
1414
heapify(x) # transforms list into a heap, in-place, in linear time
15+
item = heappushpop(heap, item) # pushes a new item and then returns
16+
# the smallest item; the heap size is unchanged
1517
item = heapreplace(heap, item) # pops and returns smallest item, and adds
1618
# new item; the heap size is unchanged
1719

0 commit comments

Comments
 (0)