On 19 Oct 2013 02:56, "Brett Cannon" <br...@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. > > Does anyone see a good reason not to take the more optimistic route in the finder? As I said, the only thing I see breaking user code is if they have a directory or something named spam.py and so the finder claims it found a module when in fact it didn't and thus stopping the search for the module from continuing.
I suspect anything that makes weird import edge case failures harder to debug than they already are won't be worth it. My opinion would likely differ if the speed up on offer was dramatic, but it sounds like that isn't the case. (Also, customised Python builds may have additional extensions that are at higher risk of being used on directory names) Cheers, Nick. > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com >
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com