[Python-checkins] cpython (merge default -> default): Merge with default
brett.cannon
python-checkins at python.org
Mon Nov 10 02:23:00 CET 2014
https://hg.python.org/cpython/rev/55b89e5f9c37
changeset: 93447:55b89e5f9c37
parent: 93446:6e6532d313a1
parent: 93445:0c34a2532e31
user: Brett Cannon <brett at python.org>
date: Sun Nov 09 20:22:53 2014 -0500
summary:
Merge with default
files:
Doc/library/functools.rst | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst
--- a/Doc/library/functools.rst
+++ b/Doc/library/functools.rst
@@ -21,8 +21,8 @@
.. function:: cmp_to_key(func)
- Transform an old-style comparison function to a key function. Used with
- tools that accept key functions (such as :func:`sorted`, :func:`min`,
+ Transform an old-style comparison function to a :term:`key function`. Used
+ with tools that accept key functions (such as :func:`sorted`, :func:`min`,
:func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`,
:func:`itertools.groupby`). This function is primarily used as a transition
tool for programs being converted from Python 2 which supported the use of
@@ -31,13 +31,14 @@
A comparison function is any callable that accept two arguments, compares them,
and returns a negative number for less-than, zero for equality, or a positive
number for greater-than. A key function is a callable that accepts one
- argument and returns another value indicating the position in the desired
- collation sequence.
+ argument and returns another value to be used as the sort key.
Example::
sorted(iterable, key=cmp_to_key(locale.strcoll)) # locale-aware sort order
+ For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`.
+
.. versionadded:: 3.2
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list