uheapq – heap queue algorithm


Though this MicroPython-based library may be available for use in some builds of CircuitPython, it is unsupported and its functionality may change in the future, perhaps significantly. As CircuitPython continues to develop, it may be changed to comply more closely with the corresponding standard Python library. You will likely need to change your code later if you rely on any non-standard functionality it currently provides.

This module implements a subset of the corresponding CPython module, as described below. For more information, refer to the original CPython documentation: heapq.

This module implements the heap queue algorithm.

A heap queue is simply a list that has its elements stored in a certain way.


uheapq.heappush(heap, item)

Push the item onto the heap.


Pop the first item from the heap, and return it. Raises IndexError if heap is empty.


Convert the list x into a heap. This is an in-place operation.