summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-08-23 15:00:04 (GMT)
committerBrett Cannon <brett@python.org>2013-08-23 15:00:04 (GMT)
commitf9f045896124148dc518b7d35f8faf1e2862c571 (patch)
treefccd46a6a6e8b920d32396f09f19845ff9392eac
parentbfc1e1a9cd669e5e4b2d288a5c0cdc407a93074a (diff)
parentf5ebd264032fbcb07a41a49031c2281f81c9a814 (diff)
downloadcpython-f9f045896124148dc518b7d35f8faf1e2862c571.zip
cpython-f9f045896124148dc518b7d35f8faf1e2862c571.tar.gz
cpython-f9f045896124148dc518b7d35f8faf1e2862c571.tar.bz2
merge emphasized discouragement of overriding __import__
-rw-r--r--Doc/library/functions.rst9
1 files changed, 5 insertions, 4 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index a37d496..399f1ff 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1467,10 +1467,11 @@ are always available. They are listed here in alphabetical order.
This function is invoked by the :keyword:`import` statement. It can be
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`) to attain the same goals. Direct use of
- :func:`__import__` is entirely discouraged in favor of
- :func:`importlib.import_module`.
+ :keyword:`import` statement, but doing so is **strongly** discouraged as it
+ is usually simpler to use import hooks (see :pep:`302`) to attain the same
+ goals and does not cause issues with code which assumes the default import
+ implementation is in use. Direct use of :func:`__import__` is also
+ 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.