From 53bdf093437349907807da9143f9c2bdcea9ab3a Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Thu, 13 Mar 2008 19:03:51 +0000 Subject: Issue 2274: Add heapq.heappushpop(). --- Doc/library/heapq.rst | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Doc/library/heapq.rst') diff --git a/Doc/library/heapq.rst b/Doc/library/heapq.rst index 115d223692..1168fb688a 100644 --- a/Doc/library/heapq.rst +++ b/Doc/library/heapq.rst @@ -45,6 +45,13 @@ The following functions are provided: Pop and return the smallest item from the *heap*, maintaining the heap invariant. If the heap is empty, :exc:`IndexError` is raised. +.. function:: heappushpop(heap, item) + + Push *item* on the heap, then pop and return the smallest item from the + *heap*. The combined action runs more efficiently than :func:`heappush` + followed by a separate call to :func:`heappop`. + + .. versionadded:: 2.6 .. function:: heapify(x) -- cgit v1.2.1