From a4330c355801117b6ab4e8c4efc19b0c58592157 Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Wed, 14 Jun 2023 00:18:14 +0300 Subject: [PATCH] Update heapq from Python 3.11 --- Lib/heapq.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/heapq.py b/Lib/heapq.py index fabefd87f..2fd9d1ff4 100644 --- a/Lib/heapq.py +++ b/Lib/heapq.py @@ -12,6 +12,8 @@ heappush(heap, item) # pushes a new item on the heap item = heappop(heap) # pops the smallest item from the heap item = heap[0] # smallest item on the heap without popping it heapify(x) # transforms list into a heap, in-place, in linear time +item = heappushpop(heap, item) # pushes a new item and then returns + # the smallest item; the heap size is unchanged item = heapreplace(heap, item) # pops and returns smallest item, and adds # new item; the heap size is unchanged