Skip to content

Commit 9b7b3a6

Browse files
Mariattaoldk1331
andauthored
bpo-32674: Improve the docstring for __import__ (GH-5339) (GH-5494)
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 461d225) Co-authored-by: oldk <[email protected]>
1 parent b7a2c17 commit 9b7b3a6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Python/bltinmodule.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ PyDoc_STRVAR(import_doc,
5454
"__import__(name, globals={}, locals={}, fromlist=[], level=-1) -> module\n\
5555
\n\
5656
Import a module. Because this function is meant for use by the Python\n\
57-
interpreter and not for general use it is better to use\n\
57+
interpreter and not for general use, it is better to use\n\
5858
importlib.import_module() to programmatically import a module.\n\
5959
\n\
6060
The globals argument is only used to determine the context;\n\
@@ -63,9 +63,8 @@ should be a list of names to emulate ``from name import ...'', or an\n\
6363
empty list to emulate ``import name''.\n\
6464
When importing a module from a package, note that __import__('A.B', ...)\n\
6565
returns package A when fromlist is empty, but its submodule B when\n\
66-
fromlist is not empty. Level is used to determine whether to perform \n\
67-
absolute or relative imports. -1 is the original strategy of attempting\n\
68-
both absolute and relative imports, 0 is absolute, a positive number\n\
66+
fromlist is not empty. The level argument is used to determine whether to\n\
67+
perform absolute or relative imports: 0 is absolute, while a positive number\n\
6968
is the number of parent directories to search relative to the current module.");
7069

7170

0 commit comments

Comments
 (0)