[Python-Dev] Complexity of import.c

James C. Ahlstrom jim@interet.com
Tue, 10 Dec 2002 10:09:46 -0500


Martin v. Löwis wrote:
> So what would have been the problem with linear search that makes this
> extra data structure strictly necessary to have?

Speed.  The linear search would be repeated with each import.

> I think you can't really cover all cases. For example, your patch fails
> to find zlib in the Unix build tree, as the build directory is added to
> sys.path only in site.py, and your patch won't attempt to import zlib
> outside InitZip.

Hmm, you are right.  But easily fixed.

JimA