[Python-Dev] zipimport & import hooks

Fredrik Lundh fredrik@pythonware.com
Fri, 6 Dec 2002 13:52:58 +0100


Just van Rossum wrote:

> It seems the majority doesn't like non-strings on sys.path, which to =
me is
> understandable, especially if you take PYTHONPATH into consideration. =
Let's try
> to focus on that.

Has anyone presented any hard data, or are people just guessing?  As far
as I can tell, I'm the only one here who has posted fragile code from a =
real
shipping product -- and I still believe it's a bogus argument.

A quick look in our code repository indicates that most common sys.path
operation is insert/append, followed by not using it at all, followed by =
not
using it at all, followed by not using it at all, followed by =
calculating a list
of dictionaries and *replacing* the current sys.path, followed by =
looping
over sys.path to scan for data or plugin modules (most such code is al-
ready safe, none will break "silently" if a non-string object would =
appear
on sys.path out of the blue).  Compared to the append changes (lots of
work), moving from exception strings to instances (caused some of the
trickiest bugs I've ever seen), and other non-compatible changes, the
impact here is close to zero.

I can dig out more detailed data if necessary (but not today).

Anyone else?

</F>