Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
913adce3
Commit
913adce3
authored
Apr 14, 2012
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify that one should not use __import__() directly. Also mention
PEP 328 in explaining how 'index' works.
parent
58c61909
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
Doc/library/functions.rst
Doc/library/functions.rst
+5
-3
No files found.
Doc/library/functions.rst
View file @
913adce3
...
...
@@ -1447,8 +1447,9 @@ are always available. They are listed here in alphabetical order.
replaced (by importing the :mod:`builtins` module and assigning to
``builtins.__import__``) in order to change semantics of the
:keyword:`import` statement, but nowadays it is usually simpler to use import
hooks (see :pep:`302`). Direct use of :func:`__import__` is rare, except in
cases where you want to import a module whose name is only known at runtime.
hooks (see :pep:`302`) to attain the same goals. Direct use of
:func:`__import__` is entirely discouraged in favor of
:func:`importlib.import_module`.
The function imports the module *name*, potentially using the given *globals*
and *locals* to determine how to interpret the name in a package context.
...
...
@@ -1460,7 +1461,8 @@ are always available. They are listed here in alphabetical order.
*level* specifies whether to use absolute or relative imports. ``0`` (the
default) means only perform absolute imports. Positive values for
*level* indicate the number of parent directories to search relative to the
directory of the module calling :func:`__import__`.
directory of the module calling :func:`__import__` (see :pep:`328` for the
details).
When the *name* variable is of the form ``package.module``, normally, the
top-level package (the name up till the first dot) is returned, *not* the
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment