| Store | Cart

PEP 328: Imports: Multi-Line and Absolute/Relative

From: John Roth <news...@jhrothjr.com>
Mon, 8 Mar 2004 20:04:17 -0500
"Aahz" <aahz at pythoncraft.com> wrote in message
news:c2ikqo$f3h$1 at panix2.panix.com...
> I'm a bit late with this, but better late than never...

[snip the actual PEP]

I'm cool with the parenthesis and the (eventual) move to
absolute import semantics.

However, I think there is a significant problem with the
relative import: it seems like there's a problem distinguishing
downward and upward references.

I think this is a serious conceptual issue, and I'd
prefer to not support upwards references at all.
That doesn't mean they should be prohibited, but
if someone wants to dig a pit for himself with circular
coupling across module hierarchies, then he should
be required to wield the shovel himself. It is not, after
all, that difficult to sort through sys.modules to figure
out where you are in the import hierarchy.

That leaves references to the current package.
I'm going to suggest an "*" as an indicator for
"this package." The reason for an asterisk is my
background in mainframe assembler: it means "here"
in that language, so I'm obviously not particularly
attached to it. It's also already in use in the "from
foo import *" syntax.

A reference beginning in the current directory is
thus:

import *.spam.eggs

Well, that's my opinion.

John Roth

Recent Messages in this Thread
Aahz Mar 08, 2004 08:24 pm
John Roth Mar 09, 2004 01:04 am
Aahz Mar 10, 2004 10:49 am
John Roth Mar 10, 2004 01:04 pm
Stephen Horne Mar 10, 2004 04:44 pm
John Roth Mar 10, 2004 06:14 pm
Stephen Horne Mar 09, 2004 01:09 am
Mike Mar 09, 2004 03:39 am
Josiah Carlson Mar 09, 2004 06:34 am
Sean Ross Mar 09, 2004 06:13 pm
Paul Rubin Mar 09, 2004 10:44 pm
Josiah Carlson Mar 10, 2004 04:20 am
Andrew Clover Mar 10, 2004 01:18 pm
Sean Ross Mar 10, 2004 03:11 pm
Josiah Carlson Mar 12, 2004 07:06 am
Thomas Heller Mar 09, 2004 07:41 am
Andrew Clover Mar 09, 2004 10:12 am
Denis S. Otkidach Mar 09, 2004 10:50 am
Gerrit Mar 10, 2004 11:41 am
Anders J. Munch Mar 10, 2004 02:46 pm
Dieter Maurer Mar 11, 2004 10:29 pm
Geoff Howland Mar 14, 2004 12:50 am
Aahz Mar 10, 2004 11:01 am
John Roth Mar 10, 2004 01:13 pm
Messages in this thread