ID EN
Heapq

heapreplace

Python 3.11

Pop and return the smallest item from the heap, and also push the new item. The heap size doesn’t change. If the heap is empty, IndexError is raised.

Syntax

PYTHON
heapq.heapreplace(heap, item)

See Also

IndexError heappop() heappush() heappushpop()