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

R. David Murray report at bugs.python.org
Sat Jul 12 20:34:43 CEST 2014

R. David Murray added the comment:

Unless I'm misremembering, it is exactly __lt__ (or __gt__, if __lt__ returns NotImplemented) that sorting depends on.  Since I'm sure there is code out there that depends on this fact, I wonder if it should be part of the language definition.

Also, the comparison documentation (https://docs.python.org/3/reference/expressions.html#comparisons) speaks about "total ordering" as being the requirement, which has a specific mathematical meaning (which sets, for example, do not satisfy, even though they have a __lt__ method).  Whether or not the distinction is worth explaining in the tutorial is a open question.


Python tracker <report at bugs.python.org>

More information about the docs mailing list