[Python-Dev] zipimport & import hooks

Kevin Jacobs jacobs@penguin.theopalgroup.com
Fri, 6 Dec 2002 09:09:22 -0500 (EST)


On Fri, 6 Dec 2002, Fredrik Lundh wrote:
> quick question: would the following variation of feeling #2 be acceptable:
> 
> >   2) They don't care if Python stores objects, strings, or bananas in
> >      sys.path, so long as 
> > 
> >        sys.path=map(str,sys.path) 
> 
> +
> +      on a sys.path set up by the Python interpreter itself
> 
> >      results in a human-readable path and does not change how imports occur.

I suppose, though the motivation behind it is not transparant to me.  There
are many places in Python where a user can do fruity things, and the general
response has been "DON'T DO THAT!".  Is your qualification an attempt to
close such a loophole or is there a realistic use-case that is affected?

For discussion, here is another use-case that I care about (a little):

  Consider a PYTHONPATH includes a mix of filesystem paths, zip files, maybe
  some tgz or tar.bz2 files.

  We would expect that:

    ':'.join(map(str,sys.path)) == os.environ['PYTHONPATH']

  modulo path normalization and any "extra" items that Python decided to
  toss into sys.path.

-Kevin

--
Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19         E-mail: jacobs@theopalgroup.com
Fax:   (216) 986-0714              WWW:    http://www.theopalgroup.com