diff options
Diffstat (limited to 'Doc/library/functions.rst')
-rw-r--r-- | Doc/library/functions.rst | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 0126831..afa9198 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -959,31 +959,20 @@ available. They are listed here in alphabetical order. ``a[start:stop:step]`` or ``a[start:stop, i]``. -.. function:: sorted(iterable[, cmp[, key[, reverse]]]) +.. function:: sorted(iterable[, key[, reverse]]) Return a new sorted list from the items in *iterable*. - The optional arguments *cmp*, *key*, and *reverse* have the same meaning as + The optional arguments *key* and *reverse* have the same meaning as those for the :meth:`list.sort` method (described in section :ref:`typesseq-mutable`). - *cmp* specifies a custom comparison function of two arguments (iterable - elements) which should return a negative, zero or positive number depending on - whether the first argument is considered smaller than, equal to, or larger than - the second argument: ``cmp=lambda x,y: cmp(x.lower(), y.lower())``. The default - value is ``None``. - *key* specifies a function of one argument that is used to extract a comparison key from each list element: ``key=str.lower``. The default value is ``None``. *reverse* is a boolean value. If set to ``True``, then the list elements are sorted as if each comparison were reversed. - In general, the *key* and *reverse* conversion processes are much faster than - specifying an equivalent *cmp* function. This is because *cmp* is called - multiple times for each list element while *key* and *reverse* touch each - element only once. - .. function:: staticmethod(function) |