]> granicus.if.org Git - python/commitdiff
#18034: update FAQ to suggest importlib.import_module instead of __import__. Patch...
authorEzio Melotti <ezio.melotti@gmail.com>
Mon, 4 Aug 2014 16:34:29 +0000 (19:34 +0300)
committerEzio Melotti <ezio.melotti@gmail.com>
Mon, 4 Aug 2014 16:34:29 +0000 (19:34 +0300)
Doc/faq/programming.rst
Misc/ACKS

index 71194d0a92753966fe5f99e4883965e2ced0e0f3..d85563fee1135a67069d95d6fd4b170a91e08d11 100644 (file)
@@ -1786,19 +1786,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?
index 87a3264d4eba43b5458b25b20a27206a17215429..08ca65f7abc69117ed680f74f028b6e9891221bb 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -549,6 +549,7 @@ Bernhard Herzog
 Magnus L. Hetland
 Raymond Hettinger
 Kevan Heydon
+Wouter van Heyst
 Kelsey Hightower
 Jason Hildebrand
 Richie Hindle