cpython: 7bfc0a45542c (original) (raw)
Mercurial > cpython
changeset 71602:7bfc0a45542c 3.2
Let the doc of __import__ link to importlib (#9254). importlib.import_module eschews a number of issues that __import__ has. Reviewed by Brett Cannon. (The docstring of __import__ was already updated in 3d490c3a019e, for #7397.) [#9254]
Éric Araujo merwok@netwok.org | |
---|---|
date | Fri, 29 Jul 2011 17:50:58 +0200 |
parents | f02a8f906342 |
children | 939631c6bc6f |
files | Doc/library/functions.rst |
diffstat | 1 files changed, 2 insertions(+), 9 deletions(-)[+] [-] Doc/library/functions.rst 11 |
line wrap: on
line diff
--- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1387,7 +1387,7 @@ are always available. They are listed h .. note:: This is an advanced function that is not needed in everyday Python
programming.[](#l1.7)
programming, unlike :func:`importlib.import_module`.[](#l1.8)
This function is invoked by the :keyword:import
statement. It can be
replaced (by importing the :mod:builtins
module and assigning to
@@ -1437,15 +1437,8 @@ are always available. They are listed h
names.
If you simply want to import a module (potentially within a package) by name,
>>> import sys[](#l1.19)
>>> name = 'foo.bar.baz'[](#l1.20)
>>> __import__(name)[](#l1.21)
<module 'foo' from ...>[](#l1.22)
>>> baz = sys.modules[name][](#l1.23)
>>> baz[](#l1.24)
<module 'foo.bar.baz' from ...>[](#l1.25)