summaryrefslogtreecommitdiffstats
path: root/Doc/library/heapq.rst
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2014-10-28 11:58:47 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2014-10-28 11:58:47 (GMT)
commita7d19fe93b5f6f085a1be03242e72ecb187cdc06 (patch)
tree9f96ad337e86b3b81700b6aaf726a902f9df3a4b /Doc/library/heapq.rst
parentd838911bb90486003cc850e398762c963c701335 (diff)
parent9b1e92f5a199acf20041372950b96e5896e1b634 (diff)
downloadcpython-a7d19fe93b5f6f085a1be03242e72ecb187cdc06.zip
cpython-a7d19fe93b5f6f085a1be03242e72ecb187cdc06.tar.gz
cpython-a7d19fe93b5f6f085a1be03242e72ecb187cdc06.tar.bz2
#22237: merge with 3.4.
Diffstat (limited to 'Doc/library/heapq.rst')
-rw-r--r--Doc/library/heapq.rst4
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/library/heapq.rst b/Doc/library/heapq.rst
index 2a41434..7c39d82 100644
--- a/Doc/library/heapq.rst
+++ b/Doc/library/heapq.rst
@@ -135,7 +135,6 @@ pushing all values onto a heap and then popping off the smallest values one at a
time::
>>> def heapsort(iterable):
- ... 'Equivalent to sorted(iterable)'
... h = []
... for value in iterable:
... heappush(h, value)
@@ -144,6 +143,9 @@ time::
>>> heapsort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+This is similar to ``sorted(iterable)``, but unlike :func:`sorted`, this
+implementation is not stable.
+
Heap elements can be tuples. This is useful for assigning comparison values
(such as task priorities) alongside the main record being tracked::