[Python-Dev] Dropping init.py requirement for subpackages (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Wed Apr 26 22:17:58 CEST 2006


Phillip J. Eby wrote:

At 11:50 AM 4/26/2006 -0700, Guido van Rossum wrote:

I'm not sure what you mean by "one directory read". You'd have to list the entire directory, which may require reading more than one block if the directory is large. You have to do this to find an init.py too, don't you? Technically, there's going to be a search for a .pyc or .pyo first, anyway.

No. Python does stat(2) and open(2) to determine whether a file is present in a directory. Whether or not that causes a full directory scan depends on the operating system. On most operating systems, it is not a full directory scan:

Regards, Martin



More information about the Python-Dev mailing list