summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2014-08-04 16:34:29 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2014-08-04 16:34:29 (GMT)
commitc468abafc7a8690be365d1eb192c4551b03c2856 (patch)
tree08a153d01e9d25755720b11f482731826875bd38
parentae4108612c961990bb2e6498f60e1f41c3993c04 (diff)
downloadcpython-c468abafc7a8690be365d1eb192c4551b03c2856.zip
cpython-c468abafc7a8690be365d1eb192c4551b03c2856.tar.gz
cpython-c468abafc7a8690be365d1eb192c4551b03c2856.tar.bz2
#18034: update FAQ to suggest importlib.import_module instead of __import__. Patch by Wouter van Heyst.
-rw-r--r--Doc/faq/programming.rst15
-rw-r--r--Misc/ACKS1
2 files changed, 4 insertions, 12 deletions
diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst
index e383393..13464b9 100644
--- a/Doc/faq/programming.rst
+++ b/Doc/faq/programming.rst
@@ -1925,19 +1925,10 @@ These solutions are not mutually exclusive.
__import__('x.y.z') returns <module 'x'>; how do I get z?
---------------------------------------------------------
-Try::
-
- __import__('x.y.z').y.z
-
-For more realistic situations, you may have to do something like ::
-
- m = __import__(s)
- for i in s.split(".")[1:]:
- m = getattr(m, i)
-
-See :mod:`importlib` for a convenience function called
-:func:`~importlib.import_module`.
+Consider using the convenience function :func:`~importlib.import_module` from
+:mod:`importlib` instead::
+ z = importlib.import_module('x.y.z')
When I edit an imported module and reimport it, the changes don't show up. Why does this happen?
diff --git a/Misc/ACKS b/Misc/ACKS
index 3751fd7..a5e9b4e 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -545,6 +545,7 @@ Bernhard Herzog
Magnus L. Hetland
Raymond Hettinger
Kevan Heydon
+Wouter van Heyst
Kelsey Hightower
Jason Hildebrand
Richie Hindle