- Glossary - K
- ********
- key function
- A key function or collation function is a callable that returns a
- value used for sorting or ordering. For example,
- "locale.strxfrm()" is used to produce a sort key that is aware of
- locale specific sort conventions.
- A number of tools in Python accept key functions to control how
- elements are ordered or grouped. They include "min()", "max()",
- "sorted()", "list.sort()", "heapq.merge()", "heapq.nsmallest()",
- "heapq.nlargest()", and "itertools.groupby()".
- There are several ways to create a key function. For example. the
- "str.lower()" method can serve as a key function for case
- insensitive sorts. Alternatively, a key function can be built from
- a "lambda" expression such as "lambda r: (r[0], r[2])". Also,
- "operator.attrgetter()", "operator.itemgetter()", and
- "operator.methodcaller()" are three key function constructors. See
- the Sorting HOW TO for examples of how to create and use key
- functions.
- keyword argument
- See *argument*.
Python software and documentation are licensed under the PSF License Agreement.
Starting with Python 3.8.6, examples, recipes, and other code in the documentation are dual licensed under the PSF License Agreement and the Zero-Clause BSD license.
Some software incorporated into Python is under different licenses. The licenses are listed with code falling under that license. See Licenses and Acknowledgements for Incorporated Software for an incomplete list of these licenses.
Python and it's documentation is:
Copyright © 2001-2022 Python Software Foundation. All rights reserved.
Copyright © 2000 BeOpen.com. All rights reserved.
Copyright © 1995-2000 Corporation for National Research Initiatives. All rights reserved.
Copyright © 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
See History and License for complete license and permissions information:
https://docs.python.org/3/license.html#psf-license