[Python-Dev] Re: PEP 328 -- relative and multi-line import

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Apr 14 20:14:21 EDT 2004

> What is the rationale given for not allowing:
> import .moduleY
> as a relative import statement meaning "from the package containing the
> module running the import statement, import moduleY"?

Probably because it's not clear what name to bind the
imported module to, and in what namespace.

With the current import syntax, you refer to the imported
module using exactly the same name (or dotted sequence of
names) that you used when importing, but that's not
possible in this case, because ".moduleY" is not a
valid Python expression.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list