diff options
author | Barry Warsaw <barry@python.org> | 2017-10-17 19:52:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-17 19:52:38 (GMT) |
commit | 191e3138200906e43cba9347177914325b54843f (patch) | |
tree | 56b77b61f9b986a892eac6ef425e646afb61ebde /Doc/library/importlib.rst | |
parent | 6cfa927ceb931ad968b5b03e4a2bffb64a8a0604 (diff) | |
download | cpython-191e3138200906e43cba9347177914325b54843f.zip cpython-191e3138200906e43cba9347177914325b54843f.tar.gz cpython-191e3138200906e43cba9347177914325b54843f.tar.bz2 |
bpo-31799: Make module.__spec__ more discoverable (#4010)
bpo-31799: Make module.__spec__ more discoverable
Diffstat (limited to 'Doc/library/importlib.rst')
-rw-r--r-- | Doc/library/importlib.rst | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 3a72648..3d350e8 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1048,7 +1048,15 @@ find and load modules. .. class:: ModuleSpec(name, loader, *, origin=None, loader_state=None, is_package=None) - A specification for a module's import-system-related state. + A specification for a module's import-system-related state. This is + typically exposed as the module's ``__spec__`` attribute. In the + descriptions below, the names in parentheses give the corresponding + attribute available directly on the module object. + E.g. ``module.__spec__.origin == module.__file__``. Note however that + while the *values* are usually equivalent, they can differ since there is + no synchronization between the two objects. Thus it is possible to update + the module's ``__path__`` at runtime, and this will not be automatically + reflected in ``__spec__.submodule_search_locations``. .. versionadded:: 3.4 |