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 N
By Guest on 13th November 2022 09:23:28 PM | Syntax: PYTHON | Views: 172



New Paste New paste | Download Paste Download | Toggle Line Numbers Show/Hide line no. | Copy Paste Copy text to clipboard
  1. Glossary - N
  2. ********
  3.  
  4. named tuple
  5.    The term "named tuple" applies to any type or class that inherits
  6.    from tuple and whose indexable elements are also accessible using
  7.    named attributes.  The type or class may have other features as
  8.    well.
  9.  
  10.    Several built-in types are named tuples, including the values
  11.    returned by "time.localtime()" and "os.stat()".  Another example is
  12.    "sys.float_info":
  13.  
  14.       >>> sys.float_info[1]                   # indexed access
  15.       1024
  16.       >>> sys.float_info.max_exp              # named field access
  17.       1024
  18.       >>> isinstance(sys.float_info, tuple)   # kind of tuple
  19.       True
  20.  
  21.    Some named tuples are built-in types (such as the above examples).
  22.    Alternatively, a named tuple can be created from a regular class
  23.    definition that inherits from "tuple" and that defines named
  24.    fields.  Such a class can be written by hand or it can be created
  25.    with the factory function "collections.namedtuple()".  The latter
  26.    technique also adds some extra methods that may not be found in
  27.    hand-written or built-in named tuples.
  28.  
  29. namespace
  30.    The place where a variable is stored.  Namespaces are implemented
  31.    as dictionaries.  There are the local, global and built-in
  32.    namespaces as well as nested namespaces in objects (in methods).
  33.    Namespaces support modularity by preventing naming conflicts.  For
  34.    instance, the functions "builtins.open" and "os.open()" are
  35.    distinguished by their namespaces.  Namespaces also aid readability
  36.    and maintainability by making it clear which module implements a
  37.    function.  For instance, writing "random.seed()" or
  38.    "itertools.islice()" makes it clear that those functions are
  39.    implemented by the "random" and "itertools" modules, respectively.
  40.  
  41. namespace package
  42.    A **PEP 420** *package* which serves only as a container for
  43.    subpackages.  Namespace packages may have no physical
  44.    representation, and specifically are not like a *regular package*
  45.    because they have no "__init__.py" file.
  46.  
  47.    See also *module*.
  48.  
  49. nested scope
  50.    The ability to refer to a variable in an enclosing definition.  For
  51.    instance, a function defined inside another function can refer to
  52.    variables in the outer function.  Note that nested scopes by
  53.    default work only for reference and not for assignment.  Local
  54.    variables both read and write in the innermost scope.  Likewise,
  55.    global variables read and write to the global namespace.  The
  56.    "nonlocal" allows writing to outer scopes.
  57.  
  58. new-style class
  59.    Old name for the flavor of classes now used for all class objects.
  60.    In earlier Python versions, only new-style classes could use
  61.    Python's newer, versatile features like "__slots__", descriptors,
  62.   properties, "__getattribute__()", class methods, and static
  63.   methods.
















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