summaryrefslogtreecommitdiffstats
path: root/Doc/library/sys.rst
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-03-21 03:11:16 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-03-21 03:11:16 (GMT)
commite43b060b05e3d99f83bc900e5efc5cdb34298888 (patch)
tree750d9fdf871efccd124512002e46ba584e92739f /Doc/library/sys.rst
parentb487e632826a45bb81925d1577856637c3fcafa0 (diff)
downloadcpython-e43b060b05e3d99f83bc900e5efc5cdb34298888.zip
cpython-e43b060b05e3d99f83bc900e5efc5cdb34298888.tar.gz
cpython-e43b060b05e3d99f83bc900e5efc5cdb34298888.tar.bz2
Document import's semantics for the language reference. This includes filling
in missing details for the sys module.
Diffstat (limited to 'Doc/library/sys.rst')
-rw-r--r--Doc/library/sys.rst37
1 files changed, 37 insertions, 0 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 632e550..c29e7fe 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -478,6 +478,22 @@ always available.
characters are stored as UCS-2 or UCS-4.
+.. 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 :keyword:`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.
+
+
.. data:: modules
This is a dictionary that maps module names to modules which have already been
@@ -508,6 +524,27 @@ always available.
:data:`sys.path`.
+.. data:: path_hooks
+
+ A list of callables that take a path argument to try to create a
+ :term:`finder` for the path. If a finder can be created, it is to be
+ returned by the callable, else raise :exc:`ImportError`.
+
+ Originally specified in :pep:`302`.
+
+
+.. data:: path_importer_cache
+
+ A dictionary acting as a cache for :term:`finder` objects. The keys are
+ paths that have been passed to :data:`sys.path_hooks` and the values are
+ the finders that are found. If a path is a valid file system path but no
+ explicit finder is found on :data:`sys.path_hooks` then :keyword:`None` is
+ stored to represent the implicit default finder should be used. If the path
+ is not an existing path then :class:`imp.NullImporter` is set.
+
+ Originally specified in :pep:`302`.
+
+
.. data:: platform
This string contains a platform identifier that can be used to append