- Glossary - N
- ********
- named tuple
- The term "named tuple" applies to any type or class that inherits
- from tuple and whose indexable elements are also accessible using
- named attributes. The type or class may have other features as
- well.
- Several built-in types are named tuples, including the values
- returned by "time.localtime()" and "os.stat()". Another example is
- "sys.float_info":
- >>> sys.float_info[1] # indexed access
- 1024
- >>> sys.float_info.max_exp # named field access
- 1024
- >>> isinstance(sys.float_info, tuple) # kind of tuple
- True
- Some named tuples are built-in types (such as the above examples).
- Alternatively, a named tuple can be created from a regular class
- definition that inherits from "tuple" and that defines named
- fields. Such a class can be written by hand or it can be created
- with the factory function "collections.namedtuple()". The latter
- technique also adds some extra methods that may not be found in
- hand-written or built-in named tuples.
- namespace
- The place where a variable is stored. Namespaces are implemented
- as dictionaries. There are the local, global and built-in
- namespaces as well as nested namespaces in objects (in methods).
- Namespaces support modularity by preventing naming conflicts. For
- instance, the functions "builtins.open" and "os.open()" are
- distinguished by their namespaces. Namespaces also aid readability
- and maintainability by making it clear which module implements a
- function. For instance, writing "random.seed()" or
- "itertools.islice()" makes it clear that those functions are
- implemented by the "random" and "itertools" modules, respectively.
- namespace package
- A **PEP 420** *package* which serves only as a container for
- subpackages. Namespace packages may have no physical
- representation, and specifically are not like a *regular package*
- because they have no "__init__.py" file.
- See also *module*.
- nested scope
- The ability to refer to a variable in an enclosing definition. For
- instance, a function defined inside another function can refer to
- variables in the outer function. Note that nested scopes by
- default work only for reference and not for assignment. Local
- variables both read and write in the innermost scope. Likewise,
- global variables read and write to the global namespace. The
- "nonlocal" allows writing to outer scopes.
- new-style class
- Old name for the flavor of classes now used for all class objects.
- In earlier Python versions, only new-style classes could use
- Python's newer, versatile features like "__slots__", descriptors,
- properties, "__getattribute__()", class methods, and static
- 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