python24.zip
Dieter Maurer
dieter at handshake.de
Sat May 21 14:36:05 EDT 2005
"Martin v. Löwis" <martin at v.loewis.de> writes on Fri, 20 May 2005 18:13:56 +0200:
> Robin Becker wrote:
> > Firstly should python start up with non-existent entries on the path?
>
> Yes, this is by design.
>
> > Secondly is this entry be the default for some other kind of python
> > installation?
>
> Yes. People can package everything they want in python24.zip (including
> site.py). This can only work if python24.zip is already on the path
> (and I believe it will always be sought in the directory where
> python24.dll lives).
The question was:
"should python start up with **non-existent** objects on the path".
I think there is no reason why path needs to contain an object
which does not exist (at the time the interpreter starts).
In your use case, "python24.zip" does exist and therefore may
be on the path. When "python24.zip" does not exist, it does
not contain anything and especially not "site.py".
I recently analysed excessive import times and
saw thousands of costly and unneccesary filesystem operations due to:
* long "sys.path", especially containing non-existing objects
Although non-existent, about 5 filesystem operations are
tried on them for any module not yet located.
* a severe weakness in Python's import hook treatment
When there is an importer "i" for a path "p" and
this importer cannot find module "m", then "p" is
treated as a directory and 5 file system operations
are tried to locate "p/m". Of course, all of them fail
when "p" happens to be a zip archive.
Dieter
More information about the Python-list
mailing list