mirror of
https://github.com/python/cpython.git
synced 2026-01-03 05:54:03 +00:00
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.
This commit is contained in:
parent
2a7bddaab7
commit
b4e1b92aab
1 changed files with 3 additions and 1 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue