[Python-Dev] Relative Package Imports

Greg Stein gstein@lyra.org
Tue, 14 Sep 1999 17:24:25 -0700 (PDT)


On Tue, 14 Sep 1999, M.-A. Lemburg wrote:
>...
> I have the unsatisfying impression that this discussion doesn't
> lead anywhere. I can't really understand all the evil sides Tim and
> Guido seem to see in their views of relative imports. For people
> like Jim and me, who have quite some experience in doing
> Python packages, this small (! hey, it's only about 20 lines of
> code !) additional feature could be of great use.

$| was probably a small addition to Perl, but I don't think you could then
argue that it was a good thing to do.

Small doesn't mean good.

Any change "could be of great use" to *somebody*, but does it make it good
for Python as a whole?

Changes imply doc, maintenance, future compatibility, etc.

> I'm still waiting for some ultimate argument that blows 
> relative imports away. The arguments put forward so far have
> all been in the category "evil", "ugly", "I don't like it".
> Hey, we can do better than that...

People seem to be disagreeing with your stated requirement. In other
words, they're saying that you shouldn't be attempting to make your
package "portable across the module-import-space."

I tend to agree. Fix it at one location. If an app doesn't like that, then
they can individually compensate. I don't believe that Python's standard
machinery is required to handle this particular notion of packaging.

> Note that if this doesn't work out, Jim and I could always agree on
> some standard import hook that we'd both use, but that's
> exactly what we would very much like to avoid in favour of some
> established standard hard-wired into the Python distribution.

No reason the standard hook could not go into imputil.py. I believe people
mostly care that it doesn't become *standard* or *default* behavior --
that it only is available when explicitly requested by an app.

Cheers,
-g

--
Greg Stein, http://www.lyra.org/