summaryrefslogtreecommitdiffstats
path: root/Lib/heapq.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-09-06 07:04:09 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-09-06 07:04:09 (GMT)
commit8158e849305d0e0ab3e19cdc93a86bb7d5fc0651 (patch)
treebf2e3439c231960aef92109f2c4f032db1623375 /Lib/heapq.py
parent7d3755d2c0d6d586308666b1dddf185f0169c320 (diff)
downloadcpython-8158e849305d0e0ab3e19cdc93a86bb7d5fc0651.zip
cpython-8158e849305d0e0ab3e19cdc93a86bb7d5fc0651.tar.gz
cpython-8158e849305d0e0ab3e19cdc93a86bb7d5fc0651.tar.bz2
Fix erroneous docstring comment.
Diffstat (limited to 'Lib/heapq.py')
-rw-r--r--Lib/heapq.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/heapq.py b/Lib/heapq.py
index 9fb4e70..14a00dc 100644
--- a/Lib/heapq.py
+++ b/Lib/heapq.py
@@ -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