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

Skip to content

Commit eae40ba

Browse files
committed
Merged revisions 86187 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ........ r86187 | georg.brandl | 2010-11-05 07:10:41 +0000 (Fr, 05 Nov 2010) | 1 line Move glossary entry to the right position and fix link. ........
1 parent 34b3e59 commit eae40ba

2 files changed

Lines changed: 22 additions & 20 deletions

File tree

Doc/glossary.rst

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -283,26 +283,6 @@ Glossary
283283
instances of user-defined classes are hashable by default; they all
284284
compare unequal, and their hash value is their :func:`id`.
285285

286-
key function
287-
A key function or collation function is a callable that returns a value
288-
used for sorting or ordering. For example, :func:`locale.strxfrm` is
289-
used to produce a sort key that is aware of locale specific sort
290-
conventions.
291-
292-
A number of tools in Python accept key functions to control how elements
293-
are ordered or grouped. They include :func:`min`, :func:`max`,
294-
:func:`sorted`, :meth:`list.sort`, :func:`heapq.nsmallest`,
295-
:func:`heapq.nlargest`, and :func:`itertools.groupby`.
296-
297-
There are several ways to create a key function. For example. the
298-
:meth:`str.lower` method can serve as a key function for case insensitive
299-
sorts. Alternatively, an ad-hoc key function can be built from a
300-
:keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``. Also,
301-
the :mod:`operator` module provides three key function constuctors:
302-
:func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and
303-
:func:`~operator.methodcaller`. See the :ref:`Sorting HOW TO` for
304-
examples of how to create and use key functions.
305-
306286
IDLE
307287
An Integrated Development Environment for Python. IDLE is a basic editor
308288
and interpreter environment which ships with the standard distribution of
@@ -370,6 +350,26 @@ Glossary
370350

371351
More information can be found in :ref:`typeiter`.
372352

353+
key function
354+
A key function or collation function is a callable that returns a value
355+
used for sorting or ordering. For example, :func:`locale.strxfrm` is
356+
used to produce a sort key that is aware of locale specific sort
357+
conventions.
358+
359+
A number of tools in Python accept key functions to control how elements
360+
are ordered or grouped. They include :func:`min`, :func:`max`,
361+
:func:`sorted`, :meth:`list.sort`, :func:`heapq.nsmallest`,
362+
:func:`heapq.nlargest`, and :func:`itertools.groupby`.
363+
364+
There are several ways to create a key function. For example. the
365+
:meth:`str.lower` method can serve as a key function for case insensitive
366+
sorts. Alternatively, an ad-hoc key function can be built from a
367+
:keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``. Also,
368+
the :mod:`operator` module provides three key function constuctors:
369+
:func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and
370+
:func:`~operator.methodcaller`. See the :ref:`Sorting HOW TO
371+
<sortinghowto>` for examples of how to create and use key functions.
372+
373373
keyword argument
374374
Arguments which are preceded with a ``variable_name=`` in the call.
375375
The variable name designates the local name in the function to which the

Doc/howto/sorting.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _sortinghowto:
2+
13
Sorting HOW TO
24
**************
35

0 commit comments

Comments
 (0)