summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorAdam Niederer <AdamNiederer@users.noreply.github.com>2017-03-05 16:56:05 (GMT)
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2017-03-05 16:56:05 (GMT)
commitb4e1b92aabcd302ac54fa58cd4fee8a138dbb5aa (patch)
tree01308359766ecefed1a5e222dd5f9a3fbb6eff2f /Doc
parent2a7bddaab7d6e1f7b243cdbb4fa6f6c8e266b18d (diff)
downloadcpython-b4e1b92aabcd302ac54fa58cd4fee8a138dbb5aa.zip
cpython-b4e1b92aabcd302ac54fa58cd4fee8a138dbb5aa.tar.gz
cpython-b4e1b92aabcd302ac54fa58cd4fee8a138dbb5aa.tar.bz2
Docs: Add note regarding "reversed" flag in heapq.merge (#300)
The docs for `heapq.merge` are a little misleading. Iterables passed into heapq.merge with the reversed flag enabled must be sorted from largest to smallest to achieve the desired sorting effect, but the previous paragraph states that they should be sorted from smallest to largest.
Diffstat (limited to 'Doc')
-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 7e33e74..e36ca8d 100644
--- a/Doc/library/heapq.rst
+++ b/Doc/library/heapq.rst
@@ -100,7 +100,9 @@ The module also offers three general purpose functions based on heaps.
``None`` (compare the elements directly).
*reverse* is a boolean value. If set to ``True``, then the input elements
- are merged as if each comparison were reversed.
+ are merged as if each comparison were reversed. To achieve behavior similar
+ to ``sorted(itertools.chain(*iterables), reverse=True)``, all iterables must
+ be sorted from largest to smallest.
.. versionchanged:: 3.5
Added the optional *key* and *reverse* parameters.