mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
Update: usage doc for heappushpop (GH-91451)
This commit is contained in:
parent
a573cb2fec
commit
d7d4a0583f
1 changed files with 2 additions and 0 deletions
|
@ -12,6 +12,8 @@ heappush(heap, item) # pushes a new item on the heap
|
||||||
item = heappop(heap) # pops the smallest item from the heap
|
item = heappop(heap) # pops the smallest item from the heap
|
||||||
item = heap[0] # smallest item on the heap without popping it
|
item = heap[0] # smallest item on the heap without popping it
|
||||||
heapify(x) # transforms list into a heap, in-place, in linear time
|
heapify(x) # transforms list into a heap, in-place, in linear time
|
||||||
|
item = heappushpop(heap, item) # pushes a new item and then returns
|
||||||
|
# the smallest item; the heap size is unchanged
|
||||||
item = heapreplace(heap, item) # pops and returns smallest item, and adds
|
item = heapreplace(heap, item) # pops and returns smallest item, and adds
|
||||||
# new item; the heap size is unchanged
|
# new item; the heap size is unchanged
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue