[Python-checkins] r55023 - peps/trunk/pep-0328.txt peps/trunk/pep-3100.txt
brett.cannon
python-checkins at python.org
Mon Apr 30 02:55:39 CEST 2007
Author: brett.cannon
Date: Mon Apr 30 02:55:35 2007
New Revision: 55023
Modified:
peps/trunk/pep-0328.txt
peps/trunk/pep-3100.txt
Log:
Add mention that indirection entries in sys.modules will not be supported once
absolute/relative imports are the only import semantics supported.
Specifically mention that this will definitely happen for Python 3.0.
Modified: peps/trunk/pep-0328.txt
==============================================================================
--- peps/trunk/pep-0328.txt (original)
+++ peps/trunk/pep-0328.txt Mon Apr 30 02:55:35 2007
@@ -278,6 +278,26 @@
system.
+Relative Imports and Indirection Entries in sys.modules
+=======================================================
+
+When packages were introduced, the concept of an indirection entry in
+sys.modules came into existence [2]_. When an entry in sys.modules
+for a module within a package had a value of None, it represented that
+the module actually referenced the top-level module. For instance,
+'Sound.Effects.string' might have a value of None in sys.modules.
+That meant any import that resolved to that name actually was to
+import the top-level 'string' module.
+
+This introduced an optimization for when a relative import was meant
+to resolve to an absolute import. But since this PEP makes a very
+clear delineation between absolute and relative imports, this
+optimization is no longer needed. When absolute/relative imports
+become the only import semantics available then indirection entries in
+sys.modules will no longer be supported.
+
+
+
References
==========
@@ -297,6 +317,8 @@
.. [1] http://mail.python.org/pipermail/python-dev/2004-March/043739.html
+.. [2] http://www.python.org/doc/essays/packages.html
+
Copyright
=========
Modified: peps/trunk/pep-3100.txt
==============================================================================
--- peps/trunk/pep-3100.txt (original)
+++ peps/trunk/pep-3100.txt Mon Apr 30 02:55:35 2007
@@ -83,8 +83,10 @@
where floats are inadvertantly accepted (PyArg_ParseTuple() i & l formats)
* Remove from ... import * at function scope. This means that functions
can always be optimized and support for unoptimized functions can go away.
-* Imports will be absolute by default. [done]
- Relative imports must be explicitly specified [#pep328]_ [done]
+* Imports [#pep328]_
+ + Imports will be absolute by default. [done]
+ + Relative imports must be explicitly specified. [done]
+ + Indirection entires in sys.modules will not be supported.
* __init__.py might become optional in sub-packages. __init__.py will still
be required for top-level packages.
* Cleanup the Py_InitModule() variants {,3,4} (also import and parser APIs)
More information about the Python-checkins
mailing list