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

Skip to content

Commit c275e15

Browse files
committed
Move glossary entry to the right position and fix link.
1 parent 3c6a951 commit c275e15

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
@@ -288,26 +288,6 @@ Glossary
288288
instances of user-defined classes are hashable by default; they all
289289
compare unequal, and their hash value is their :func:`id`.
290290

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

376356
More information can be found in :ref:`typeiter`.
377357

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