diff options
author | Raymond Hettinger <python@rcn.com> | 2008-03-13 19:03:51 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-03-13 19:03:51 +0000 |
commit | 53bdf093437349907807da9143f9c2bdcea9ab3a (patch) | |
tree | 11b94ee0f3c83f57e7870a4abfc44760cccdeef8 /Doc/library/heapq.rst | |
parent | 431f0294867b474525a2f91e03101d1462f56801 (diff) | |
download | cpython-git-53bdf093437349907807da9143f9c2bdcea9ab3a.tar.gz |
Issue 2274: Add heapq.heappushpop().
Diffstat (limited to 'Doc/library/heapq.rst')
-rw-r--r-- | Doc/library/heapq.rst | 7 |
1 files changed, 7 insertions, 0 deletions
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) |