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

heapq.heappushpop_max

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


Import

import heapq
from heapq import heappushpop_max

Signature & Overview

heapq.heappushpop_max(heap, item, /)

Maxheap variant of heappushpop.

Usage

import heapq

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

Gotchas

REPL Inspect

from heapq import heappushpop_max
help(heappushpop_max)

Linked from

Related notes