Skip to content

Commit e985afc

Browse files
miss-islingtonoldk1331
authored andcommitted
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 461d225) Co-authored-by: oldk <oldk1331@users.noreply.github.com>
1 parent 7876778 commit e985afc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Python/bltinmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ PyDoc_STRVAR(import_doc,
317317
"__import__(name, globals=None, locals=None, fromlist=(), level=0) -> module\n\
318318
\n\
319319
Import a module. Because this function is meant for use by the Python\n\
320-
interpreter and not for general use it is better to use\n\
320+
interpreter and not for general use, it is better to use\n\
321321
importlib.import_module() to programmatically import a module.\n\
322322
\n\
323323
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\
326326
empty list to emulate ``import name''.\n\
327327
When importing a module from a package, note that __import__('A.B', ...)\n\
328328
returns package A when fromlist is empty, but its submodule B when\n\
329-
fromlist is not empty. Level is used to determine whether to perform \n\
330-
absolute or relative imports. 0 is absolute while a positive number\n\
329+
fromlist is not empty. The level argument is used to determine whether to\n\
330+
perform absolute or relative imports: 0 is absolute, while a positive number\n\
331331
is the number of parent directories to search relative to the current module.");
332332

333333

0 commit comments

Comments
 (0)