summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-08-09 02:17:24 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-08-09 02:17:24 (GMT)
commitd74ca12fddc8d57295d62bb84cc491992e5f8b26 (patch)
treedddba8a4e54b71aa0fc764c63c724ba113c3231a /Doc
parenta03ff6d3cde5184746bbf9d6f5355402628cbbd7 (diff)
downloadcpython-d74ca12fddc8d57295d62bb84cc491992e5f8b26.zip
cpython-d74ca12fddc8d57295d62bb84cc491992e5f8b26.tar.gz
cpython-d74ca12fddc8d57295d62bb84cc491992e5f8b26.tar.bz2
Merged revisions 83872 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83872 | benjamin.peterson | 2010-08-08 21:13:10 -0500 (Sun, 08 Aug 2010) | 1 line use 3 space indents ........
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/functools.rst33
1 files changed, 16 insertions, 17 deletions
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst
index 93b2b4a..0c5e57b 100644
--- a/Doc/library/functools.rst
+++ b/Doc/library/functools.rst
@@ -19,23 +19,22 @@ The :mod:`functools` module defines the following functions:
.. 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`,
- :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`,
- :func:`itertools.groupby`).
- This function is primarily used as a transition tool for programs
- being converted to Py3.x where comparison functions are no longer
- supported.
-
- A compare 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 that indicates
- the position in the desired collation sequence.
-
- Example::
-
- sorted(iterable, key=cmp_to_key(locale.strcoll)) # locale-aware sort order
+ Transform an old-style comparison function to a 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 to Py3.x where comparison functions are no
+ longer supported.
+
+ A compare 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 that indicates the position in the desired
+ collation sequence.
+
+ Example::
+
+ sorted(iterable, key=cmp_to_key(locale.strcoll)) # locale-aware sort order
.. versionadded:: 2.7