diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-02-02 04:51:36 (GMT) |
---|---|---|
committer | Mariatta <Mariatta@users.noreply.github.com> | 2018-02-02 04:51:36 (GMT) |
commit | e985afc38dac3ee5b44d80c638e45ca738a03a23 (patch) | |
tree | 46be9a839f0aa4b02de16fd71e0ac602ea45a890 /Python/bltinmodule.c | |
parent | 78767786a87b00925506c32b3b55cf65b56ef3d7 (diff) | |
download | cpython-e985afc38dac3ee5b44d80c638e45ca738a03a23.zip cpython-e985afc38dac3ee5b44d80c638e45ca738a03a23.tar.gz cpython-e985afc38dac3ee5b44d80c638e45ca738a03a23.tar.bz2 |
bpo-32674: Improve the docstring for __import__ (GH-5339) (GH-5488)
Clarify that the level argument is used to determine whether to
perform absolute or relative imports: 0 is absolute, while a positive number
is the number of parent directories to search relative to the current module.
(cherry picked from commit 461d225b195eec5269f317323b41115516144c41)
Co-authored-by: oldk <oldk1331@users.noreply.github.com>
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index d8971be..94f2908 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -317,7 +317,7 @@ PyDoc_STRVAR(import_doc, "__import__(name, globals=None, locals=None, fromlist=(), level=0) -> module\n\ \n\ Import a module. Because this function is meant for use by the Python\n\ -interpreter and not for general use it is better to use\n\ +interpreter and not for general use, it is better to use\n\ importlib.import_module() to programmatically import a module.\n\ \n\ The globals argument is only used to determine the context;\n\ @@ -326,8 +326,8 @@ should be a list of names to emulate ``from name import ...'', or an\n\ empty list to emulate ``import name''.\n\ When importing a module from a package, note that __import__('A.B', ...)\n\ returns package A when fromlist is empty, but its submodule B when\n\ -fromlist is not empty. Level is used to determine whether to perform \n\ -absolute or relative imports. 0 is absolute while a positive number\n\ +fromlist is not empty. The level argument is used to determine whether to\n\ +perform absolute or relative imports: 0 is absolute, while a positive number\n\ is the number of parent directories to search relative to the current module."); |