summaryrefslogtreecommitdiff
path: root/Doc/library/sys.rst
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2015-12-04 15:46:21 -0800
committerBrett Cannon <brett@python.org>2015-12-04 15:46:21 -0800
commitccddbb186bcaec77f52a8c37d8b3f56de4b871dd (patch)
tree00b9e18d5a507a49fe2f5ed97535d13ba64a4942 /Doc/library/sys.rst
parentf4f25fe576ca86a51c8e4f98a801f32879d7a582 (diff)
downloadcpython-git-ccddbb186bcaec77f52a8c37d8b3f56de4b871dd.tar.gz
Issue #23936: Clarify what finders are.
Thanks to Raúl Cumplido for the bug report and Thomas Kluyver for the patch.
Diffstat (limited to 'Doc/library/sys.rst')
-rw-r--r--Doc/library/sys.rst39
1 files changed, 26 insertions, 13 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index f6325cc8c1..36e8ee4087 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -774,19 +774,32 @@ always available.
.. data:: meta_path
- A list of :term:`finder` objects that have their :meth:`find_module`
- methods called to see if one of the objects can find the module to be
- imported. The :meth:`find_module` method is called at least with the
- absolute name of the module being imported. If the module to be imported is
- contained in package then the parent package's :attr:`__path__` attribute
- is passed in as a second argument. The method returns ``None`` if
- the module cannot be found, else returns a :term:`loader`.
-
- :data:`sys.meta_path` is searched before any implicit default finders or
- :data:`sys.path`.
-
- See :pep:`302` for the original specification.
-
+ A list of :term:`meta path finder` objects that have their
+ :meth:`~importlib.abc.MetaPathFinder.find_spec` methods called to see if one
+ of the objects can find the module to be imported. The
+ :meth:`~importlib.abc.MetaPathFinder.find_spec` method is called with at
+ least the absolute name of the module being imported. If the module to be
+ imported is contained in a package, then the parent package's :attr:`__path__`
+ attribute is passed in as a second argument. The method returns a
+ :term:`module spec`, or ``None`` if the module cannot be found.
+
+ .. seealso::
+
+ :class:`importlib.abc.MetaPathFinder`
+ The abstract base class defining the interface of finder objects on
+ :data:`meta_path`.
+ :class:`importlib.machinery.ModuleSpec`
+ The concrete class which
+ :meth:`~importlib.abc.MetaPathFinder.find_spec` should return
+ instances of.
+
+ .. versionchanged:: 3.4
+
+ :term:`Module specs <module spec>` were introduced in Python 3.4, by
+ :pep:`451`. Earlier versions of Python looked for a method called
+ :meth:`~importlib.abc.MetaPathFinder.find_module`.
+ This is still called as a fallback if a :data:`meta_path` entry doesn't
+ have a :meth:`~importlib.abc.MetaPathFinder.find_spec` method.
.. data:: modules