[Python-Dev] possibility of shaving a stat call from imports
Antoine Pitrou
solipsis at pitrou.net
Fri Oct 18 22:59:29 CEST 2013
On Fri, 18 Oct 2013 12:53:55 -0400
Brett Cannon <brett at python.org> wrote:
> importlib.machinery.FileFinder does a stat call to check if a path is a
> file if the package check failed. Now I'm willing to bet that the check is
> rather redundant as the file extension should be a dead give-away that
> something in a directory is a file and not some non-file type. The import
> would still fail even if this is the case in the loader when attempting to
> read from the file, but it happens a little later and it means finders
> would be more permissive in claiming they found a loader.
Is it one stat() call per successful import? Or one stat() call per
sys.path entry?
Regards
Antoine.
More information about the Python-Dev
mailing list