summaryrefslogtreecommitdiffstats
path: root/Doc/library/functions.rst
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-01-30 20:15:17 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-01-30 20:15:17 (GMT)
commit70b64fce96e894dfa8af5afd1f8b3fe863ba16e0 (patch)
tree15d549753edea1f11c0a3990ea0419426220c445 /Doc/library/functions.rst
parent4f066126d616d35aa8c0911a915ad64a09aaf16e (diff)
downloadcpython-70b64fce96e894dfa8af5afd1f8b3fe863ba16e0.zip
cpython-70b64fce96e894dfa8af5afd1f8b3fe863ba16e0.tar.gz
cpython-70b64fce96e894dfa8af5afd1f8b3fe863ba16e0.tar.bz2
Issue #1771: Remove cmp parameter from list.sort() and builtin.sorted().
Diffstat (limited to 'Doc/library/functions.rst')
-rw-r--r--Doc/library/functions.rst15
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)