[Python-Dev] Some comments on PEP 328 (absolute/relative imports)
Guido van Rossum
guido at python.org
Wed Apr 7 00:14:21 EDT 2004
> Done. Seems that the final remaining issue is the meaning of "."
> inside __init__.py -- does it refer to the current package or the
> parent? Guido, if you don't want to Pronounce, I'll post to c.l.py
> requesting feedback.
It ought to refer to the current package. After all, in __init__.py,
relative imports (today) also work the same way as inside other
modules of that package.
__init__.py is funny that way (funny strange, not funny ha ha :-): its
__dict__ namespace is that of the package, i.e. the parent of the
package's submodules; but its location in the package tree is
equivalent to that of a submodule of the package. That's just how it
is, and once you think about it long enough that's the only way it
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev