Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 87fc6f5

Browse files
committed
merge
2 parents df1b699 + 86e9b6b commit 87fc6f5

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Doc/library/functools.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ The :mod:`functools` module defines the following functions:
2121

2222
.. function:: cmp_to_key(func)
2323

24-
Transform an old-style comparison function to a key function. Used with
25-
tools that accept key functions (such as :func:`sorted`, :func:`min`,
24+
Transform an old-style comparison function to a :term:`key function`. Used
25+
with tools that accept key functions (such as :func:`sorted`, :func:`min`,
2626
:func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`,
2727
:func:`itertools.groupby`). This function is primarily used as a transition
2828
tool for programs being converted from Python 2 which supported the use of
@@ -31,13 +31,14 @@ The :mod:`functools` module defines the following functions:
3131
A comparison function is any callable that accept two arguments, compares them,
3232
and returns a negative number for less-than, zero for equality, or a positive
3333
number for greater-than. A key function is a callable that accepts one
34-
argument and returns another value indicating the position in the desired
35-
collation sequence.
34+
argument and returns another value to be used as the sort key.
3635

3736
Example::
3837

3938
sorted(iterable, key=cmp_to_key(locale.strcoll)) # locale-aware sort order
4039

40+
For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`.
41+
4142
.. versionadded:: 3.2
4243

4344

0 commit comments

Comments
 (0)