diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2017-10-17 19:59:21 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2017-10-17 19:59:21 (GMT) |
commit | 858ea4354fafa36e57859d2dfd70f8a057984075 (patch) | |
tree | 86b074a114136dd1490b2946decfbc8b363d51c7 /Doc/library | |
parent | 06949585d292d1a9dbf2d0d0fa8fc8fe1dee3ccf (diff) | |
download | cpython-858ea4354fafa36e57859d2dfd70f8a057984075.zip cpython-858ea4354fafa36e57859d2dfd70f8a057984075.tar.gz cpython-858ea4354fafa36e57859d2dfd70f8a057984075.tar.bz2 |
[3.6] bpo-31799: Make module.__spec__ more discoverable (GH-4010) (#4021)
bpo-31799: Make module.__spec__ more discoverable
(cherry picked from commit 191e3138200906e43cba9347177914325b54843f)
Diffstat (limited to 'Doc/library')
-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 6406e30..d194362 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1045,7 +1045,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 |