Add return value type of import functions to docs

This commit is contained in:
Alexey Shrub 2019-11-29 09:54:08 +03:00
parent fe75b62575
commit 4fcf1df957
2 changed files with 5 additions and 3 deletions

View File

@ -1775,6 +1775,8 @@ are always available. They are listed here in alphabetical order.
goals and does not cause issues with code which assumes the default import goals and does not cause issues with code which assumes the default import
implementation is in use. Direct use of :func:`__import__` is also implementation is in use. Direct use of :func:`__import__` is also
discouraged in favor of :func:`importlib.import_module`. discouraged in favor of :func:`importlib.import_module`.
Usually function returns :class:`types.ModuleType` object, but no guarantees
for that. If nothing found :exc:`ModuleNotFoundError` will be raised.
The function imports the module *name*, potentially using the given *globals* The function imports the module *name*, potentially using the given *globals*
and *locals* to determine how to interpret the name in a package context. and *locals* to determine how to interpret the name in a package context.

View File

@ -90,9 +90,9 @@ Functions
.. function:: import_module(name, package=None) .. function:: import_module(name, package=None)
Import a module. The *name* argument specifies what module to Import a module, for return value information see :func:`__import__`.
import in absolute or relative terms The *name* argument specifies what module to import in absolute or
(e.g. either ``pkg.mod`` or ``..mod``). If the name is relative terms (e.g. either ``pkg.mod`` or ``..mod``). If the name is
specified in relative terms, then the *package* argument must be set to specified in relative terms, then the *package* argument must be set to
the name of the package which is to act as the anchor for resolving the the name of the package which is to act as the anchor for resolving the
package name (e.g. ``import_module('..mod', 'pkg.subpkg')`` will import package name (e.g. ``import_module('..mod', 'pkg.subpkg')`` will import