[Python-Dev] imputil

Thomas Heller thomas.heller@ion-tof.com
Fri, 17 Nov 2000 18:24:17 +0100


> Thomas Heller wrote:
> > 
> > imputil, which is now an official part of
> > python, changes the semantics of sys.path
> > as soon as importers are installed.
> > 
> > On the other hand, a quick and dirty search
> > finds at least these files in the standard library
> > where it is assumed that sys.path is a list of strings:
> > 
> > linecache.py, profile.py, pdb.py, pyclbr.py
> > 
> > Should imputil be fixed to install the ImportManager
> > in a different way (not installing the importers
> > into sys.path), or should the library be fixed?
[MAL]
> 
> My understanding was that Importers need to provide
> a __str__ method which is then used... haven't looked
> at imputil.py in ages though, so I can't really comment.
> 
No importer currently does define __str__, neither is it used
in the standard libary. The pattern is (in linecache):

        for dirname in sys.path:
            fullname = os.path.join(dirname, basename)

> Perhaps imputil.py should leave sys.path alone (or maybe just
> wipe it from unneeded entries) and use a new sys.importers
> object for the import management ?!
This sounds better.

Thomas