diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2014-08-04 16:34:57 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2014-08-04 16:34:57 (GMT) |
commit | 48b8e4afd1177c1e9a8a5134f8c3bbae11b62004 (patch) | |
tree | f48d765e47af539b5b354aac1f0d210be269eaec /Doc | |
parent | 17c336284d3292a62a6ddcb4ffff4679ce717f6a (diff) | |
parent | e4aad5ab3242f2a346b2c86ff84e19d96e7a7b88 (diff) | |
download | cpython-48b8e4afd1177c1e9a8a5134f8c3bbae11b62004.zip cpython-48b8e4afd1177c1e9a8a5134f8c3bbae11b62004.tar.gz cpython-48b8e4afd1177c1e9a8a5134f8c3bbae11b62004.tar.bz2 |
#18034: merge with 3.4.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/faq/programming.rst | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst index 71194d0..d85563f 100644 --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -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? |