Add return value type of import functions to docs
This commit is contained in:
parent
fe75b62575
commit
4fcf1df957
|
@ -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
|
||||
implementation is in use. Direct use of :func:`__import__` is also
|
||||
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*
|
||||
and *locals* to determine how to interpret the name in a package context.
|
||||
|
|
|
@ -90,9 +90,9 @@ Functions
|
|||
|
||||
.. 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
|
||||
Import a module, for return value information see :func:`__import__`.
|
||||
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 set to
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue