summaryrefslogtreecommitdiffstats
path: root/Doc/library/importlib.rst
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-01-26 01:16:50 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-01-26 01:16:50 (GMT)
commit93881c6c58296f26b2560c27aeee7b425f211e9f (patch)
tree813d4845c4ae52ee063653c44187458460923671 /Doc/library/importlib.rst
parentaaedcef5786f10593b51d389423b5d7ce97727c0 (diff)
downloadcpython-93881c6c58296f26b2560c27aeee7b425f211e9f.zip
cpython-93881c6c58296f26b2560c27aeee7b425f211e9f.tar.gz
cpython-93881c6c58296f26b2560c27aeee7b425f211e9f.tar.bz2
Backport importlib in the form of providing importlib.import_module(). This has
been done purely to help transitions from 2.7 to 3.1.
Diffstat (limited to 'Doc/library/importlib.rst')
-rw-r--r--Doc/library/importlib.rst27
1 files changed, 27 insertions, 0 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
new file mode 100644
index 0000000..375c2ae
--- /dev/null
+++ b/Doc/library/importlib.rst
@@ -0,0 +1,27 @@
+:mod:`importlib` -- Convenience wrappers for :func:`__import__`
+===============================================================
+
+.. module:: importlib
+ :synopsis: Convenience wrappers for __import__
+
+.. moduleauthor:: Brett Cannon <brett@python.org>
+.. sectionauthor:: Brett Cannon <brett@python.org>
+
+.. versionadded:: 2.7
+
+This module is a minor subset of what is available in the more full-featured
+package of the same name from Python 3.1 that provides a complete
+implementation of :keyword:`import`. What is here has been provided to
+help ease in transitioning from 2.7 to 3.1.
+
+
+.. function:: import_module(name, package=None)
+
+ Import a module. The *name* argument specifies what module to
+ import in absolute or relative terms
+ (e.g. either ``pkg.mod`` or ``..mod``). If the name is
+ specified in relative terms, then the *package* argument must be
+ specified to the package which is to act as the anchor for resolving the
+ package name (e.g. ``import_module('..mod', 'pkg.subpkg')`` will import
+ ``pkg.mod``). The specified module will be inserted into
+ :data:`sys.modules` and returned.