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 G
By Guest on 13th November 2022 08:01:34 AM | Syntax: PYTHON | Views: 158



New Paste New paste | Download Paste Download | Toggle Line Numbers Show/Hide line no. | Copy Paste Copy text to clipboard
  1. Glossary - G
  2. ********
  3.  
  4. garbage collection
  5.    The process of freeing memory when it is not used anymore.  Python
  6.    performs garbage collection via reference counting and a cyclic
  7.    garbage collector that is able to detect and break reference
  8.    cycles.  The garbage collector can be controlled using the "gc"
  9.    module.
  10.  
  11. generator
  12.    A function which returns a *generator iterator*.  It looks like a
  13.    normal function except that it contains "yield" expressions for
  14.    producing a series of values usable in a for-loop or that can be
  15.    retrieved one at a time with the "next()" function.
  16.  
  17.    Usually refers to a generator function, but may refer to a
  18.    *generator iterator* in some contexts.  In cases where the intended
  19.    meaning isn't clear, using the full terms avoids ambiguity.
  20.  
  21. generator iterator
  22.   An object created by a *generator* function.
  23.  
  24.   Each "yield" temporarily suspends processing, remembering the
  25.   location execution state (including local variables and pending
  26.   try-statements).  When the *generator iterator* resumes, it picks
  27.   up where it left off (in contrast to functions which start fresh on
  28.   every invocation).
  29.  
  30. generator expression
  31.   An expression that returns an iterator.  It looks like a normal
  32.   expression followed by a "for" clause defining a loop variable,
  33.   range, and an optional "if" clause.  The combined expression
  34.   generates values for an enclosing function:
  35.  
  36.      >>> sum(i*i for i in range(10))         # sum of squares 0, 1, 4, ... 81
  37.      285
  38.  
  39. generic function
  40.   A function composed of multiple functions implementing the same
  41.   operation for different types. Which implementation should be used
  42.   during a call is determined by the dispatch algorithm.
  43.  
  44.   See also the *single dispatch* glossary entry, the
  45.   "functools.singledispatch()" decorator, and **PEP 443**.
  46.  
  47. generic type
  48.   A *type* that can be parameterized; typically a container class
  49.   such as "list" or "dict". Used for *type hints* and *annotations*.
  50.  
  51.   For more details, see generic alias types, **PEP 483**, **PEP
  52.   484**, **PEP 585**, and the "typing" module.
  53.  
  54. GIL
  55.   See *global interpreter lock*.
  56.  
  57. global interpreter lock
  58.   The mechanism used by the *CPython* interpreter to assure that only
  59.   one thread executes Python *bytecode* at a time. This simplifies
  60.   the CPython implementation by making the object model (including
  61.   critical built-in types such as "dict") implicitly safe against
  62.   concurrent access.  Locking the entire interpreter makes it easier
  63.   for the interpreter to be multi-threaded, at the expense of much of
  64.   the parallelism afforded by multi-processor machines.
  65.  
  66.   However, some extension modules, either standard or third-party,
  67.   are designed so as to release the GIL when doing computationally
  68.   intensive tasks such as compression or hashing.  Also, the GIL is
  69.   always released when doing I/O.
  70.  
  71.   Past efforts to create a "free-threaded" interpreter (one which
  72.   locks shared data at a much finer granularity) have not been
  73.   successful because performance suffered in the common single-
  74.   processor case. It is believed that overcoming this performance
  75.   issue would make the implementation much more complicated and
  76.   therefore costlier to maintain.
















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