Documentación offline MicroPython (Pico) master
por @raupulus

`heapq`

master Ver versión oficial en línea Licencia MITDescargado el 2026-09-15 Bundle .md (858 KB) ↓

En esta página

heapq -- heap queue algorithm#

heapq

|see_cpython_module| python:heapq.

This module implements the min heap queue algorithm.

A heap queue is essentially a list that has its elements stored in such a way that the first item of the list is always the smallest.

Functions#

heappush(heap, item)

Push the item onto the heap.

heappop(heap)

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

The returned item will be the smallest item in the heap.

heapify(x)

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