|
Original |
Translation |
|
57
|
An object that loads a module. It must define a method named :meth:`load_module`. A loader is typically returned by a :term:`finder`. See :pep:`302` for details and :class:`importlib.abc.Loader` for an :term:`abstract base class`.
|
|
|
58
|
A container object (such as :class:`dict`) which supports arbitrary key lookups using the special method :meth:`__getitem__`.
|
|
|
59
|
The class of a class. Class definitions create a class name, a class dictionary, and a list of base classes. The metaclass is responsible for taking those three arguments and creating the class. Most object oriented programming languages provide a default implementation. What makes Python special is that it is possible to create custom metaclasses. Most users never need this tool, but when the need arises, metaclasses can provide powerful, elegant solutions. They have been used for logging attribute access, adding thread-safety, tracking object creation, implementing singletons, and many other tasks.
|
|
|
60
|
More information can be found in :ref:`metaclasses`.
|
|
|
61
|
|
62
|
Mutable objects can change their value but keep their :func:`id`. See also :term:`immutable`.
|
|
|
63
|
Any tuple-like class whose indexable elements are also accessible using named attributes (for example, :func:`time.localtime` returns a tuple-like object where the *year* is accessible either with an index such as ``t[0]`` or with a named attribute like ``t.tm_year``).
|
|
|
64
|
A named tuple can be a built-in type such as :class:`time.struct_time`, or it can be created with a regular class definition. A full featured named tuple can also be created with the factory function :func:`collections.namedtuple`. The latter approach automatically provides extra features such as a self-documenting representation like ``Employee(name='jones', title='programmer')``.
|
|
|
65
|
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 :func:`builtins.open` and :func:`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 :func:`random.seed` or :func:`itertools.izip` makes it clear that those functions are implemented by the :mod:`random` and :mod:`itertools` modules, respectively.
|
|
|
66
|
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 :attr:`__slots__`, descriptors, properties, :meth:`__getattribute__`, class methods, and static methods.
|
|