summaryrefslogtreecommitdiff
path: root/Doc/library/importlib.rst
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-02-16 04:18:01 +0000
committerBrett Cannon <bcannon@gmail.com>2009-02-16 04:18:01 +0000
commite1f4b7fd3e49a1b6b02f98f8afb5ea30d9e74d7a (patch)
tree757e076b9a7dbe17706e05f9c88aecca0c90e2b3 /Doc/library/importlib.rst
parent8ccb9921d5252a6cc0b706de700f7f776d90f86f (diff)
downloadcpython-e1f4b7fd3e49a1b6b02f98f8afb5ea30d9e74d7a.tar.gz
Document importlib.machinery.PathFinder.
Diffstat (limited to 'Doc/library/importlib.rst')
-rw-r--r--Doc/library/importlib.rst31
1 files changed, 28 insertions, 3 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index d850c7d2b2..1a33fd4d9b 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -18,12 +18,12 @@ implementation of the :keyword:`import` statement (and thus, by extension, the
:func:`__import__` function) in Python source code. This provides an
implementaiton of :keyword:`import` which is portable to any Python
interpreter. This also provides a reference implementation which is easier to
-read than one in a programming language other than Python.
+comprehend than one in a programming language other than Python.
Two, the components to implement :keyword:`import` can be exposed in this
package, making it easier for users to create their own custom objects (known
-generically as importers) to participate in the import process. Details on
-providing custom importers can be found in :pep:`302`.
+generically as an :term:`importer`) to participate in the import process.
+Details on providing custom importers can be found in :pep:`302`.
.. seealso::
@@ -126,3 +126,28 @@ find and load modules.
Class method that allows this class to be a :term:`loader` for frozen
modules.
+
+
+.. class:: PathFinder
+
+ :term:`Finder` for :data:`sys.path`.
+
+ This class does not perfectly mirror the semantics of :keyword:`import` in
+ terms of :data:`sys.path`. No implicit path hooks are assumed for
+ simplification of the class and its semantics.
+
+ Only class method are defined by this class to alleviate the need for
+ instantiation.
+
+ .. classmethod:: find_module(fullname, path=None)
+
+ Class method that attempts to find a :term:`loader` for the module
+ specified by *fullname* either on :data:`sys.path` or, if defined, on
+ *path*. For each path entry that is searched,
+ :data:`sys.path_importer_cache` is checked. If an non-false object is
+ found then it is used as the :term:`finder` to query for the module
+ being searched for. For no entry is found in
+ :data:`sys.path_importer_cache`, then :data:`sys.path_hooks` is
+ searched for a finder for the path entry and, if found, is stored in
+ :data:`sys.path_importer_cache` along with being queried about the
+ module.