
Greg Ward wrote:
On 05 October 2001, M.-A. Lemburg said:
One question: should these ZIP-archives filenames be placed in sys.path or should Python scan for ZIP-archives within the dirs on sys.path ?
I think the archive file should be listed in sys.path.
I think that is correct. At one time there was talk of sys.path containing importer instances. But currently (please check me here) sys.path is purely strings, and these strings must be directory names. Python depends on directories and subdirectories for its import semantics. So any zip archive must support subdirectories to support general imports. Therefore, a string in sys.path which is a zip file is equivalent to hanging a nameless subdirectory at that point. "Nameless" means zip archive files *.pyc occur at the top level, and the zip file may contain relative subdirectories with files sub1/file1.pyc, etc. So a zip file can always substitute for an arbitrary subdirectory tree, and is functionally equivalent to a directory name at the same place in sys.path. JimA