PyDocs

Nav

Data Types

heappop

heapq

function
  • heappop(heap)
Pop the smallest item off the heap, maintaining the heap invariant.
1 Example
>>> def heapsort(iterable):
...     h = []
...     for value in iterable:
...         heappush(h, value)
...     return [heappop(h) for i in range(len(h))]
...
>>> heapsort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
from the Python docs
See Also
No see-alsos for heapq/heappop
0 Notes
No notes for heappop