The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Python Glossary: terms starting with letter K
By Guest on 13th November 2022 07:37:07 PM | Syntax: PYTHON | Views: 190



New Paste New paste | Download Paste Download | Toggle Line Numbers Show/Hide line no. | Copy Paste Copy text to clipboard
  1. Glossary - K
  2. ********
  3.  
  4. key function
  5.    A key function or collation function is a callable that returns a
  6.    value used for sorting or ordering.  For example,
  7.    "locale.strxfrm()" is used to produce a sort key that is aware of
  8.    locale specific sort conventions.
  9.  
  10.    A number of tools in Python accept key functions to control how
  11.    elements are ordered or grouped.  They include "min()", "max()",
  12.    "sorted()", "list.sort()", "heapq.merge()", "heapq.nsmallest()",
  13.    "heapq.nlargest()", and "itertools.groupby()".
  14.  
  15.    There are several ways to create a key function.  For example. the
  16.    "str.lower()" method can serve as a key function for case
  17.    insensitive sorts.  Alternatively, a key function can be built from
  18.    a "lambda" expression such as "lambda r: (r[0], r[2])".  Also,
  19.    "operator.attrgetter()", "operator.itemgetter()", and
  20.    "operator.methodcaller()" are three key function constructors.  See
  21.    the Sorting HOW TO for examples of how to create and use key
  22.    functions.
  23.  
  24. keyword argument
  25.    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
  • Recent Pastes