Skip to content

Commit dadebab

Browse files
committed
Finally, a coherent set of terminology for all the lil' beasties involved.
1 parent cbc4c19 commit dadebab

File tree

5 files changed

+207
-174
lines changed

5 files changed

+207
-174
lines changed

Doc/glossary.rst

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,13 @@ Glossary
315315
role in places where a constant hash value is needed, for example as a key
316316
in a dictionary.
317317

318+
import path
319+
A list of locations (or :term:`path entries <path entry>`) that are
320+
searched by the :term:`path importer` for modules to import. During
321+
import, this list of locations usually comes from :data:`sys.path`, but
322+
for subpackages it may also come from the parent package's ``__path__``
323+
attribute.
324+
318325
importing
319326
The process by which Python code in one module is made available to
320327
Python code in another module.
@@ -446,8 +453,8 @@ Glossary
446453

447454
meta path finder
448455
A finder returned by a search of :data:`sys.meta_path`. Meta path
449-
finders are related to, but different from :term:`sys path finders <sys
450-
path finder>`.
456+
finders are related to, but different from :term:`path entry finders
457+
<path entry finder>`.
451458

452459
metaclass
453460
The class of a class. Class definitions create a class name, a class
@@ -541,9 +548,23 @@ Glossary
541548
subpackages. Technically, a package is a Python module with an
542549
``__path__`` attribute.
543550

551+
path entry
552+
A single location on the :term:`import path` which the :term:`path
553+
importer` consults to find modules for importing.
554+
555+
path entry finder
556+
A :term:`finder` returned by a callable on :data:`sys.path_hooks`
557+
(i.e. a :term:`path entry hook`) which knows how to locate modules given
558+
a :term:`path entry`.
559+
560+
path entry hook
561+
A callable on the :data:`sys.path_hook` list which returns a :term:`path
562+
entry finder` if it knows how to find modules on a specific :term:`path
563+
entry`.
564+
544565
path importer
545-
A built-in :term:`finder` / :term:`loader` that knows how to find and
546-
load modules from the file system.
566+
One of the default :term:`meta path finders <meta path finder>` which
567+
searches an :term:`import path` for modules.
547568

548569
portion
549570
A set of files in a single directory (possibly stored in a zip file)
@@ -671,11 +692,6 @@ Glossary
671692
:meth:`~collections.somenamedtuple._asdict`. Examples of struct sequences
672693
include :data:`sys.float_info` and the return value of :func:`os.stat`.
673694

674-
sys path finder
675-
A finder returned by a search of :data:`sys.path` by the :term:`path
676-
importer`. Sys path finders are related to, but different from
677-
:term:`meta path finders <meta path finder>`.
678-
679695
triple-quoted string
680696
A string which is bound by three instances of either a quotation mark
681697
(") or an apostrophe ('). While they don't provide any functionality

Doc/reference/datamodel.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -652,15 +652,16 @@ Modules
652652
object: module
653653

654654
Modules are a basic organizational unit of Python code, and are created by
655-
the :ref:`importmachinery` as invoked either by the :keyword:`import`
656-
statement (see section :ref:`import`) or by calling the built in
657-
:func:`__import__` function. A module object has a namespace implemented
658-
by a dictionary object (this is the dictionary referenced by the
659-
``__globals__`` attribute of functions defined in the module). Attribute
660-
references are translated to lookups in this dictionary, e.g., ``m.x`` is
661-
equivalent to ``m.__dict__["x"]``. A module object does not contain the
662-
code object used to initialize the module (since it isn't needed once the
663-
initialization is done).
655+
the :ref:`import system <importsystem>` as invoked either by the
656+
:keyword:`import` statement (see :keyword:`import`), or by calling
657+
functions such as :func:`importlib.import_module` and built-in
658+
:func:`__import__`. A module object has a namespace implemented by a
659+
dictionary object (this is the dictionary referenced by the ``__globals__``
660+
attribute of functions defined in the module). Attribute references are
661+
translated to lookups in this dictionary, e.g., ``m.x`` is equivalent to
662+
``m.__dict__["x"]``. A module object does not contain the code object used
663+
to initialize the module (since it isn't needed once the initialization is
664+
done).
664665

665666
Attribute assignment updates the module's namespace dictionary, e.g.,
666667
``m.x = 1`` is equivalent to ``m.__dict__["x"] = 1``.

0 commit comments

Comments
 (0)