Author martin.panter
Recipients Wilfred.Hughes, docs@python, georg.brandl, martin.panter, rhettinger
Date 2014-08-22.01:20:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1408670455.44.0.0361619074912.issue22237@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-08-22 01:20:55martin.pantersetrecipients: + martin.panter, georg.brandl, rhettinger, docs@python, Wilfred.Hughes
2014-08-22 01:20:55martin.pantersetmessageid: <1408670455.44.0.0361619074912.issue22237@psf.upfronthosting.co.za>
2014-08-22 01:20:55martin.panterlinkissue22237 messages
2014-08-22 01:20:54martin.pantercreate