Kaydet (Commit) b4e1b92a authored tarafından Adam Niederer's avatar Adam Niederer Kaydeden (comit) Raymond Hettinger

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.
üst 2a7bddaa
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment