[Python-checkins] r85043 - in python/branches/py3k: Misc/NEWS Python/bltinmodule.c

brett.cannon python-checkins at python.org
Mon Sep 27 23:08:38 CEST 2010


Author: brett.cannon
Date: Mon Sep 27 23:08:38 2010
New Revision: 85043

Log:
Since __import__ is not designed for general use, have its docstring point
people towards importlib.import_module().

Closes issue #7397.


Modified:
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Python/bltinmodule.c

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Mon Sep 27 23:08:38 2010
@@ -10,6 +10,9 @@
 Core and Builtins
 -----------------
 
+- Issue #7397: Mention that importlib.import_module() is probably what someone
+  really wants to be using in __import__'s docstring.
+
 - Issue #8521: Allow CreateKeyEx, OpenKeyEx, and DeleteKeyEx functions
   of winreg to use named arguments.
 

Modified: python/branches/py3k/Python/bltinmodule.c
==============================================================================
--- python/branches/py3k/Python/bltinmodule.c	(original)
+++ python/branches/py3k/Python/bltinmodule.c	Mon Sep 27 23:08:38 2010
@@ -173,8 +173,12 @@
 PyDoc_STRVAR(import_doc,
 "__import__(name, globals={}, locals={}, fromlist=[], level=-1) -> module\n\
 \n\
-Import a module.  The globals are only used to determine the context;\n\
-they are not modified.  The locals are currently unused.  The fromlist\n\
+Import a module. Because this function is meant for use by the Python\n\
+interpreter and not for general use it is better to use\n\
+importlib.import_module() to programmatically import a module.\n\
+\n\
+The globals argument is only used to determine the context;\n\
+they are not modified.  The locals argument is unused.  The fromlist\n\
 should be a list of names to emulate ``from name import ...'', or an\n\
 empty list to emulate ``import name''.\n\
 When importing a module from a package, note that __import__('A.B', ...)\n\


More information about the Python-checkins mailing list