[docs] [issue14050] Tutorial, list.sort() and items comparability

Martin Panter report at bugs.python.org
Sun Apr 12 02:00:14 CEST 2015


Martin Panter added the comment:

The first paragraph in the patch already seems to have been applied, for Issue 21575.

The Sorting How-to <https://docs.python.org/dev/howto/sorting.html#odd-and-ends> already guarantees that defining only __lt__() is sufficient for sorted() and list.sort(). And the list.sort() specification <https://docs.python.org/dev/library/stdtypes.html#list.sort> says “only < comparisons” are used, which implies that only __gt__() may also be sufficient.

It might be good to change “ordering relationship” to “total ordering relationship”, but I think further explanation and other details are probably not worth adding to the tutorial. They could be clarified in the main documentation, but that is probably a separate issue.

----------
nosy: +vadmium

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14050>
_______________________________________


More information about the docs mailing list