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

Bill Janssen janssen at parc.com
Wed Apr 7 21:33:10 EDT 2004

I really wish I'd been paying more attention to 328, which I've just
read.  This proposal seems to break lots and lots and lots of existing
code.  Maybe I'm reading it wrong.

I've written many, many packages that use the form

     import foo

where "foo" is a sibling module in the package.  Or

      from foo import bar

where, again, foo is a sibling to the current module.  Packages that
work like this have been submitted to on-line libraries, printed in
books, etc., etc., etc.

I really hope I'm reading the PEP wrong!  Am I correct in thinking
that come Python 2.4 or 2.5, these will just break if the package
isn't at the top level (reachable from sys.path)?

I was thinking (some months ago) that y'all would come up with an
absolute form instead, something like

      from / import os


      import /os


      import /email.Message

and a relative form like

      from foo import bar

to do fuzzy and imperfect matching of the module (what we have now),

      from ./foo import bar

to do more explicit matching of siblings, or

      from ../baz.foo import bar


      from -/baz.foo import bar

to go up a level.  And that the fuzzy and imperfect form would be
eventually deprecated, but never removed.


More information about the Python-Dev mailing list