mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
#22237: document that sorted() is guaranteed to be stable. Initial patch by Martin Panter.
This commit is contained in:
parent
16e7f97bcb
commit
9b1e92f5a1
2 changed files with 8 additions and 1 deletions
|
@ -1286,6 +1286,11 @@ are always available. They are listed here in alphabetical order.
|
|||
Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a
|
||||
*key* function.
|
||||
|
||||
The built-in :func:`sorted` function is guaranteed to be stable. A sort is
|
||||
stable if it guarantees not to change the relative order of elements that
|
||||
compare equal --- this is helpful for sorting in multiple passes (for
|
||||
example, sort by department, then by salary grade).
|
||||
|
||||
For sorting examples and a brief sorting tutorial, see `Sorting HowTo
|
||||
<http://wiki.python.org/moin/HowTo/Sorting/>`_\.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue