Kaydet (Commit) 461d225b authored tarafından oldk's avatar oldk Kaydeden (comit) Mariatta

bpo-32674: Improve the docstring for __import__ (GH-5339)

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.
üst 55e0839f
...@@ -317,7 +317,7 @@ PyDoc_STRVAR(import_doc, ...@@ -317,7 +317,7 @@ PyDoc_STRVAR(import_doc,
"__import__(name, globals=None, locals=None, fromlist=(), level=0) -> module\n\ "__import__(name, globals=None, locals=None, fromlist=(), level=0) -> module\n\
\n\ \n\
Import a module. Because this function is meant for use by the Python\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\ importlib.import_module() to programmatically import a module.\n\
\n\ \n\
The globals argument is only used to determine the context;\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\ ...@@ -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\ empty list to emulate ``import name''.\n\
When importing a module from a package, note that __import__('A.B', ...)\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\ 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\ fromlist is not empty. The level argument is used to determine whether to\n\
absolute or relative imports. 0 is absolute while a positive number\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."); is the number of parent directories to search relative to the current module.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment