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

heapq.heapreplace_max

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


Import

import heapq
from heapq import heapreplace_max

Signature & Overview

heapq.heapreplace_max(heap, item, /)

Maxheap variant of heapreplace.

Usage

import heapq

# Python 3.14+: max-heap counterpart to heapreplace()
assert hasattr(heapq, "heapreplace_max") or True

Gotchas

REPL Inspect

from heapq import heapreplace_max
help(heapreplace_max)

Linked from

Related notes