[New-bugs-announce] [issue45246] the sorted() documentation should refer to operator <

Dimitri Papadopoulos Orfanos report at bugs.python.org
Mon Sep 20 04:06:52 EDT 2021

New submission from Dimitri Papadopoulos Orfanos <dimitri.papadopoulos at cea.fr>:

The documentation of sorted() lacks any reference to the comparison mechanism between items.

Compare with the documentation of list.sort(), which starts with:
    using only < comparisons between items

This is mentioned in the "Sorting HOW TO", under "Odd and Ends":
    The sort routines are guaranteed to use __lt__() when making comparisons between two objects.

However, the "Sorting HOW TO" is "a brief sorting tutorial", not the reference documentation. This property needs to be documented in the reference documentation of sorted().

assignee: docs at python
components: Documentation
messages: 402209
nosy: DimitriPapadopoulosOrfanos, docs at python
priority: normal
severity: normal
status: open
title: the sorted() documentation should refer to operator <
versions: Python 3.10, Python 3.11, Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list