cpython: 751f28564a45 (original) (raw)

Mercurial > cpython

changeset 78173:751f28564a45 2.7

Closes #9254: backport __import__ docstring/doc mentions of importlib. Patch by Éric Araujo. [#9254]

R David Murray rdmurray@bitdance.com
date Wed, 18 Jul 2012 19:44:08 -0400
parents 9a3861db4341
children 77401bd4f567
files Doc/library/functions.rst Python/bltinmodule.c
diffstat 2 files changed, 8 insertions(+), 11 deletions(-)[+] [-] Doc/library/functions.rst 11 Python/bltinmodule.c 8

line wrap: on

line diff

--- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1558,7 +1558,7 @@ available. They are listed here in alph .. note:: This is an advanced function that is not needed in everyday Python

This function is invoked by the :keyword:import statement. It can be replaced (by importing the :mod:__builtin__ module and assigning to @@ -1609,15 +1609,8 @@ available. They are listed here in alph names. If you simply want to import a module (potentially within a package) by name,

.. versionchanged:: 2.5 The level parameter was added.

--- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -53,8 +53,12 @@ builtin___import__(PyObject *self, PyObj PyDoc_STRVAR(import_doc, "import(name, globals={}, locals={}, fromlist=[], level=-1) -> module\n[](#l2.5) \n[](#l2.6) -Import a module. The globals are only used to determine the context;\n[](#l2.7) -they are not modified. The locals are currently unused. The fromlist\n[](#l2.8) +Import a module. Because this function is meant for use by the Python\n[](#l2.9) +interpreter and not for general use it is better to use\n[](#l2.10) +importlib.import_module() to programmatically import a module.\n[](#l2.11) +\n[](#l2.12) +The globals argument is only used to determine the context;\n[](#l2.13) +they are not modified. The locals argument is unused. The fromlist\n[](#l2.14) should be a list of names to emulate from name import ...'', or an\n\[](#l2.15) empty list to emulate import name''.\n[](#l2.16) When importing a module from a package, note that import('A.B', ...)\n[](#l2.17)