diff options
author | Skip Montanaro <skip@pobox.com> | 2003-01-02 20:51:08 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2003-01-02 20:51:08 (GMT) |
commit | 4abd5f0fce54d32fbe01207e505047bd82ff9ca3 (patch) | |
tree | 7c94a45859968c9e92cf2c5970ee2d4071a9b7a8 /Doc | |
parent | fe8496ca03e93b74fe007de50f0e05347a772a60 (diff) | |
download | cpython-4abd5f0fce54d32fbe01207e505047bd82ff9ca3.zip cpython-4abd5f0fce54d32fbe01207e505047bd82ff9ca3.tar.gz cpython-4abd5f0fce54d32fbe01207e505047bd82ff9ca3.tar.bz2 |
Allow list sort's comparison function to explicitly be None. See SF patch
661092.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libstdtypes.tex | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex index d5c7c5d..a377426 100644 --- a/Doc/lib/libstdtypes.tex +++ b/Doc/lib/libstdtypes.tex @@ -925,7 +925,7 @@ The following operations are defined on mutable sequence types (where {same as \code{del \var{s}[\var{s}.index(\var{x})]}}{(3)} \lineiii{\var{s}.reverse()} {reverses the items of \var{s} in place}{(6)} - \lineiii{\var{s}.sort(\optional{\var{cmpfunc}})} + \lineiii{\var{s}.sort(\optional{\var{cmpfunc=None}})} {sort the items of \var{s} in place}{(6), (7), (8), (9)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} @@ -970,10 +970,11 @@ Notes: the first argument is considered smaller than, equal to, or larger than the second argument. Note that this slows the sorting process down considerably; e.g. to sort a list in reverse order it is much - faster to call method \method{sort()} followed by - \method{reverse()} than to use method - \method{sort()} with a comparison function that reverses the - ordering of the elements. + faster to call method \method{sort()} followed by \method{reverse()} + than to use method \method{sort()} with a comparison function that + reverses the ordering of the elements. Passing \constant{None} as the + comparison function is semantically equivalent to calling + \method{sort()} with no comparison function. \item[(8)] Whether the \method{sort()} method is stable is not defined by the language (a sort is stable if it guarantees not to change the |