[Python-Dev] Alternative Approach to Relative Imports

M.-A. Lemburg mal@lemburg.com
Fri, 24 Sep 1999 11:10:59 +0200


Greg Ward wrote:
> 
> On 22 September 1999, Guido van Rossum said:
> > Yes, please.  Do the long-term understandable thing here.  I expect
> > not too many packages have defined subpackages (or submodules) whose
> > name conflicts with a standard library module, so you ought to be
> > pretty safe here!
> 
> Especially since doing so doesn't work: for example, the
> distutils.errors module started life as distutils.exceptions.  That
> changed pretty quickly, once I realized why putting
> 
>    import exceptions
> 
> into other distutils modules didn't work -- obviously it didn't find my
> distutils.exceptions.  Arguably I should have used an absolute import,
> but what the heck.

Wow, so many positive answers -- not bad after that last round of
relative imports ;-)

Ok, then I'll use the walk-me-up approach. That'll be coded
into a PathImporter class I'm writing for imputil which will
try to mimic the standard behaviour as much as possible (to be
released in a few weeks after my vacation).

-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                   100 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/