Visitar URL original
GH-91415: Mention alphabetical sort ordering in the Sorting HOWTO by rhettinger · Pull Request #98336 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
.
  • Loading branch information
rhettinger committed Oct 16, 2022
commit 5acde39304690a9544e684df386a39665f4df5d9
5 changes: 3 additions & 2 deletions Doc/howto/sorting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ function computes the relative ordering for two inputs.
For example, a `balance scale
<https://upload.wikimedia.org/wikipedia/commons/1/17/Balance_à_tabac_1850.JPG>`_
compares two samples giving a relative ordering: lighter, equal, or heavier.
Likewise, a comparison functions such as ``cmp(a, b)`` will a negative value for
less-than, zero if the inputs are equal, or a positive value for greater-than.
Likewise, a comparison function such as ``cmp(a, b)`` will return a negative
value for less-than, zero if the inputs are equal, or a positive value for
greater-than.

It is common to encounter comparison functions when translating algorithms from
other languages. Also, some libraries provide comparison functions as part of
Expand Down