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 L
By Guest on 13th November 2022 07:39:49 PM | Syntax: PYTHON | Views: 199



New Paste New paste | Download Paste Download | Toggle Line Numbers Show/Hide line no. | Copy Paste Copy text to clipboard
  1. Glossary - L
  2. ********
  3.  
  4. lambda
  5.    An anonymous inline function consisting of a single *expression*
  6.    which is evaluated when the function is called.  The syntax to
  7.    create a lambda function is "lambda [parameters]: expression"
  8.  
  9. LBYL
  10.    Look before you leap.  This coding style explicitly tests for pre-
  11.    conditions before making calls or lookups.  This style contrasts
  12.    with the *EAFP* approach and is characterized by the presence of
  13.    many "if" statements.
  14.  
  15.    In a multi-threaded environment, the LBYL approach can risk
  16.    introducing a race condition between "the looking" and "the
  17.   leaping".  For example, the code, "if key in mapping: return
  18.   mapping[key]" can fail if another thread removes *key* from
  19.    *mapping* after the test, but before the lookup. This issue can be
  20.    solved with locks or by using the EAFP approach.
  21.  
  22. locale encoding
  23.    On Unix, it is the encoding of the LC_CTYPE locale. It can be set
  24.    with "locale.setlocale(locale.LC_CTYPE, new_locale)".
  25.  
  26.    On Windows, it is the ANSI code page (ex: ""cp1252"").
  27.  
  28.    On Android and VxWorks, Python uses ""utf-8"" as the locale
  29.    encoding.
  30.  
  31.    "locale.getencoding()" can be used to get the locale encoding.
  32.  
  33.    See also the *filesystem encoding and error handler*.
  34.  
  35. list
  36.    A built-in Python *sequence*.  Despite its name it is more akin to
  37.    an array in other languages than to a linked list since access to
  38.    elements is O(1).
  39.  
  40. list comprehension
  41.    A compact way to process all or part of the elements in a sequence
  42.    and return a list with the results.  "result = ['{:#04x}'.format(x)
  43.   for x in range(256) if x % 2 == 0]" generates a list of strings
  44.    containing even hex numbers (0x..) in the range from 0 to 255. The
  45.    "if" clause is optional.  If omitted, all elements in "range(256)"
  46.    are processed.
  47.  
  48. loader
  49.    An object that loads a module. It must define a method named
  50.    "load_module()". A loader is typically returned by a *finder*. See
  51.    **PEP 302** for details and "importlib.abc.Loader" for an *abstract
  52.    base class*.
















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