heapq -- Heap queue algorithm. ============================== .. This document was autogenerated by Sphinx-autoapi from a .pyi stub or a source code file. .. Do not edit this file, instead edit the source file and run Sphinx to update. .. Source: docs/stubs/heapq/__init__.pyi .. py:module:: heapq .. autoapi-nested-parse:: Heap queue algorithm. |see_cpython_module| :mod:`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 --------- .. autoapisummary:: heapq.heapify heapq.heappop heapq.heappush Module Contents --------------- .. py:function:: heapify(x) -> _typeshed.Incomplete Convert the list ``x`` into a heap. This is an in-place operation. .. py:function:: heappop(heap) -> _typeshed.Incomplete 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``. .. py:function:: heappush(heap, item) -> _typeshed.Incomplete Push the ``item`` onto the ``heap``.