summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Niederer <AdamNiederer@users.noreply.github.com>2017-03-05 11:56:05 -0500
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2017-03-05 08:56:05 -0800
commitb4e1b92aabcd302ac54fa58cd4fee8a138dbb5aa (patch)
tree01308359766ecefed1a5e222dd5f9a3fbb6eff2f
parent2a7bddaab7d6e1f7b243cdbb4fa6f6c8e266b18d (diff)
downloadcpython-git-b4e1b92aabcd302ac54fa58cd4fee8a138dbb5aa.tar.gz
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.
-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 7e33e74814..e36ca8d7b3 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.