On this page
  1. heapq.heapify_max
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

heapq.heapify_max

Prev: heapq.heapify | Up: heapq | Next: heapq.heappop
Rel: heapq.heapify, heapq.heappop, heapq.heappop_max, heapq.heappush
Ref: docs.python.org — heapq.heapify_max
Tags: #public #python3 #stdlib #heapq


Import

import heapq
from heapq import heapify_max

Signature & Overview

heapq.heapify_max(heap, /)

Maxheap variant of heapify.

Usage

import heapq

# Python 3.14+: in-place max-heap construction
if hasattr(heapq, "heapify_max"):
    nums = [1, 5, 3]
    heapq.heapify_max(nums)
    assert nums[0] == 5

Gotchas

REPL Inspect

from heapq import heapify_max
help(heapify_max)

Linked from

Related notes