diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-08-09 02:13:10 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-08-09 02:13:10 (GMT) |
commit | cca65313c4de70acc986c76d0dca43cc4cf39e85 (patch) | |
tree | 36c163d37e7f525ab673d7f7238e8248d4b8851a /Doc/library/functools.rst | |
parent | 5b0c1e07ca169feced6d6458f80c2b9ccc6227e0 (diff) | |
download | cpython-cca65313c4de70acc986c76d0dca43cc4cf39e85.zip cpython-cca65313c4de70acc986c76d0dca43cc4cf39e85.tar.gz cpython-cca65313c4de70acc986c76d0dca43cc4cf39e85.tar.bz2 |
use 3 space indents
Diffstat (limited to 'Doc/library/functools.rst')
-rw-r--r-- | Doc/library/functools.rst | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index 39b0e7b..77e92f8 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -17,23 +17,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 from Py2.x which supported the use of comparison - functions. - - 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 from Py2.x which supported the use of + comparison functions. + + 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:: 3.2 |