[Python-Dev] Relative Package Imports

Jim Fulton jim@digicool.com
Tue, 14 Sep 1999 13:24:10 +0000


"James C. Ahlstrom" wrote:
> 
> Jim Fulton wrote:
> >
> > "M.-A. Lemburg" wrote:
> > > In the end, having written a self-contained package is a "feature"
> > > of that package. Other authors can then say: ok, I can
> > > plugin your package if it's self-contained.
> >
> > Well said.  It really should be possible to provide
> > *self-contained* package hierarchies.
> 
> > There are at
> > least two people in this discussion that are trying hard to
> > make use of packages and have observed a significant problem.
> 
> OK, just to make sure I understand this.  You are saying that
> a ".." operation is needed in imports so that a package author
> with a package which looks like this:
>   mypackage
>   mypackage/sub1/mod1.py
>   mypackage/sub2/mod2.py
> 
> can write "import __.sub2.mod2" instead of "import mypackage.sub2.mod2"
> within the file mod1.py.  Right?

Yup.

Note that sys.modules would still have the absolute paths
for keys.

Jim

--
Jim Fulton           mailto:jim@digicool.com
Technical Director   (888) 344-4332              Python Powered!
Digital Creations    http://www.digicool.com     http://www.python.org

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.