Message225632
It looks like a fork of that how-to is actually part of the documentation: <https://docs.python.org/release/3.4.0/howto/sorting.html>. Perhaps the two should be linked better.
If “sorted” is indeed meant to be stable, that makes the docstring for the “heapsort” function <https://docs.python.org/release/3.4.0/library/heapq.html#basic-examples> invalid. That function is not stable, for example: heapsort((0, 0, False, 0)) -> [0, False, 0, 0].
Also, the how-to implicitly guarantees that only less-than (__lt__) is required for comparison. This is already documented for “list.sort”, but it might be good to add that guarantee to the “sorted” reference. Maybe also clarify if it applies (or not) to other sorting and comparison routines (e.g. heapq, bisect, min, max), though maybe that is straying off scope for this bug. |
|
Date |
User |
Action |
Args |
2014-08-22 01:20:55 | martin.panter | set | recipients:
+ martin.panter, georg.brandl, rhettinger, docs@python, Wilfred.Hughes |
2014-08-22 01:20:55 | martin.panter | set | messageid: <1408670455.44.0.0361619074912.issue22237@psf.upfronthosting.co.za> |
2014-08-22 01:20:55 | martin.panter | link | issue22237 messages |
2014-08-22 01:20:54 | martin.panter | create | |
|