]> granicus.if.org Git - python/commitdiff
Fix erroneous docstring comment.
authorRaymond Hettinger <python@rcn.com>
Mon, 6 Sep 2004 07:04:09 +0000 (07:04 +0000)
committerRaymond Hettinger <python@rcn.com>
Mon, 6 Sep 2004 07:04:09 +0000 (07:04 +0000)
Doc/lib/libheapq.tex
Lib/heapq.py
Modules/_heapqmodule.c

index edacf791587af4cfc6f8d47fcd57092a7dd11df1..55ef6412e3a99951ba6d46e9ed8bc0f2815d2296 100644 (file)
@@ -60,9 +60,10 @@ 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
-unless written as part of a larger expression:
+unless written as part of a conditional replacement:
 \begin{verbatim}
-        result = item <= heap[0] and item  or  heapreplace(heap, item)
+        if item > heap[0]:
+            item = heapreplace(heap, item)
 \end{verbatim}
 \end{funcdesc}
 
index 9fb4e70824028b5d81a5ec5c02426c012cec0884..14a00dc04b863e30a392dfcabc4099ed21117e38 100644 (file)
@@ -154,9 +154,10 @@ def heapreplace(heap, item):
     This is more efficient than heappop() followed by heappush(), and can be
     more appropriate when using a fixed-size heap.  Note that the value
     returned may be larger than item!  That constrains reasonable uses of
-    this routine unless written as part of a larger expression:
+    this routine unless written as part of a conditional replacement:
 
-        result = item <= heap[0] and item  or  heapreplace(heap, item)
+        if item > heap[0]:
+            item = heapreplace(heap, item)
     """
     returnitem = heap[0]    # raises appropriate IndexError if heap is empty
     heap[0] = item
index 13e6a3d6040074f4ffe42d3fc8ec0d98b8f4fa76..192e843690abb8fa318e92acff3f298bfd5fd71b 100644 (file)
@@ -186,8 +186,9 @@ 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 unless written as part of a larger expression:\n\n\
-    result = item <= heap[0] and item  or  heapreplace(heap, item)\n");
+this routine unless written as part of a conditional replacement:\n\n\
+        if item > heap[0]:\n\
+            item = heapreplace(heap, item)\n");
 
 static PyObject *
 heapify(PyObject *self, PyObject *heap)