summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libheapq.tex
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-08-03 18:53:28 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-08-03 18:53:28 (GMT)
commit0ad679ff0f014c3c29fb839f33c027d7d928a09a (patch)
tree02fa9562979f59f2b925ca25fd9fb11ef42cba8d /Doc/lib/libheapq.tex
parent6e0da82a97e3995884f4d392ffb025aad9e4092b (diff)
downloadcpython-0ad679ff0f014c3c29fb839f33c027d7d928a09a.zip
cpython-0ad679ff0f014c3c29fb839f33c027d7d928a09a.tar.gz
cpython-0ad679ff0f014c3c29fb839f33c027d7d928a09a.tar.bz2
Document new heapreplace() function.
Diffstat (limited to 'Doc/lib/libheapq.tex')
-rw-r--r--Doc/lib/libheapq.tex9
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/lib/libheapq.tex b/Doc/lib/libheapq.tex
index d1aaaae..38c38d8 100644
--- a/Doc/lib/libheapq.tex
+++ b/Doc/lib/libheapq.tex
@@ -52,6 +52,15 @@ heap invariant.
Transform list \var{x} into a heap, in-place, in linear time.
\end{funcdesc}
+\begin{funcdesc}{heapreplace}{heap, item}
+Pop and return the smallest item from the \var{heap}, and also push
+the new \var{item}. The heap size doesn't change.
+This is more efficient than \function{heappop()} followed
+by \function{heappush()}, and can be more appropriate when using
+a fixed-size heap. Note that the value returned may be larger
+than \var{item}! That constrains reasonable uses of this routine.
+\end{funcdesc}
+
Example of use:
\begin{verbatim}