diff options
author | Brett Cannon <brett@python.org> | 2013-12-13 18:57:41 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-12-13 18:57:41 (GMT) |
commit | 98620d87f2e011cbdea384c1822a3325b491d048 (patch) | |
tree | 6a142d1875dda767017f41eb113b1b2cf866c321 | |
parent | d913d9d54e6156a6998ef1f7009cc9ba8142d8a4 (diff) | |
download | cpython-98620d87f2e011cbdea384c1822a3325b491d048.zip cpython-98620d87f2e011cbdea384c1822a3325b491d048.tar.gz cpython-98620d87f2e011cbdea384c1822a3325b491d048.tar.bz2 |
Issue #19963: Document that importlib.import_module() will import
parent packages automatically.
-rw-r--r-- | Doc/library/importlib.rst | 7 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index efd027b..92339dc 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -82,10 +82,13 @@ Functions derived from :func:`importlib.__import__`, including requiring the package from which an import is occurring to have been previously imported (i.e., *package* must already be imported). The most important difference - is that :func:`import_module` returns the most nested package or module - that was imported (e.g. ``pkg.mod``), while :func:`__import__` returns the + is that :func:`import_module` returns the specified package or module + (e.g. ``pkg.mod``), while :func:`__import__` returns the top-level package or module (e.g. ``pkg``). + .. versionchanged:: 3.3 + Parent packages are automatically imported. + .. function:: find_loader(name, path=None) Find the loader for a module, optionally within the specified *path*. If the @@ -169,6 +169,9 @@ Tests Documentation ------------- +- Issue #19963: Document that importlib.import_module() no longer requires + importing parent packages separately. + - Issue #18840: Introduce the json module in the tutorial, and deemphasize the pickle module. |