summaryrefslogtreecommitdiffstats
path: root/Modules/_heapqmodule.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-06-20 09:07:53 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-06-20 09:07:53 (GMT)
commit28224f897a1849dd616ad82538bdda45f3351d42 (patch)
tree996268137e0f51ca92d0d5e93a90fae6c482d67f /Modules/_heapqmodule.c
parent1761a7cc8b3fffb7c04d81609c705f353eef14a7 (diff)
downloadcpython-28224f897a1849dd616ad82538bdda45f3351d42.zip
cpython-28224f897a1849dd616ad82538bdda45f3351d42.tar.gz
cpython-28224f897a1849dd616ad82538bdda45f3351d42.tar.bz2
Improve the documented advice on how to best use heapq.heapreplace().
Diffstat (limited to 'Modules/_heapqmodule.c')
-rw-r--r--Modules/_heapqmodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c
index 21df796..13e6a3d 100644
--- a/Modules/_heapqmodule.c
+++ b/Modules/_heapqmodule.c
@@ -186,7 +186,8 @@ PyDoc_STRVAR(heapreplace_doc,
This is more efficient than heappop() followed by heappush(), and can be\n\
more appropriate when using a fixed-size heap. Note that the value\n\
returned may be larger than item! That constrains reasonable uses of\n\
-this routine.\n");
+this routine unless written as part of a larger expression:\n\n\
+ result = item <= heap[0] and item or heapreplace(heap, item)\n");
static PyObject *
heapify(PyObject *self, PyObject *heap)