diff options
author | Brett Cannon <bcannon@gmail.com> | 2009-02-07 01:15:27 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2009-02-07 01:15:27 (GMT) |
commit | 2c318a1390e1a84c78d6f0cacaee1d21cc459234 (patch) | |
tree | 97f2579de870e21766febabe4acaaf53b8cd9eb9 /Doc | |
parent | 887b3f2625404f3835d47a63ae7e0ac4ee638cb6 (diff) | |
download | cpython-2c318a1390e1a84c78d6f0cacaee1d21cc459234.zip cpython-2c318a1390e1a84c78d6f0cacaee1d21cc459234.tar.gz cpython-2c318a1390e1a84c78d6f0cacaee1d21cc459234.tar.bz2 |
Rewrite the code implementing __import__ for importlib. Now it is much simpler
and relies much more on meta path finders to abstract out various parts of
import.
As part of this the semantics for import_module tightened up and now follow
__import__ much more closely (biggest thing is that the 'package' argument must
now already be imported, else a SystemError is raised).
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/importlib.rst | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 4d13235..d850c7d 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -72,11 +72,15 @@ Functions 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 + set 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. + ``pkg.mod``). + The :func:`import_module` function acts as a simplifying wrapper around + :func:`__import__`. This means all semantics of the function are derived + from :func:`__import__`, including requiring the package where an import is + occuring from to already be imported (i.e., *package* must already be + imported). :mod:`importlib.machinery` -- Importers and path hooks ------------------------------------------------------ |