Mercurial > cpython-lru_cache-weakref
diff Doc/lib/libstdtypes.tex @ 27036:41f7726e3e51 legacy-trunk
Allow list sort's comparison function to explicitly be None. See SF patch
661092.
| author | Skip Montanaro <skip@pobox.com> |
|---|---|
| date | Thu, 02 Jan 2003 20:51:08 +0000 |
| parents | 6932794817c2 |
| children | 5d42dba49fe5 |
line wrap: on
line diff
--- a/Doc/lib/libstdtypes.tex Thu Jan 02 20:33:26 2003 +0000 +++ b/Doc/lib/libstdtypes.tex Thu Jan 02 20:51:08 2003 +0000 @@ -925,7 +925,7 @@ {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 @@ 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
