Brett Cannon wrote: > So there are a total of five to six depending on the OS (actually, VMS > goes up to eight!) before a search path is considered not to contain a > module.
The windows list is actually going to be slightly different (dir, pyd, py, pyw, py[co]). It looks for .pyd files rather than either flavour of .so file (we stopped allowing .dll files some time back due to the sqlite3 DLL naming conflict). So I believe it is always 5 stat calls on the major platform - dropping the bytecode filename check saves 20% of them on a miss. I'm not convinced that saving is worth the hassle of incurring a whole pile of subtle backward compatibility problems. It seems better to say "Python doesn't create in-place bytecode files anymore, but if you arrange to put them there yourself we'll still read them". I certainly wouldn't support removing the feature without some solid benchmarks to say that it really is going to significantly speed up typical import times for non-trivial modules (given that part of the definition of "non-trivial" is "significant amounts of code to be run when imported", that bar is likely to be a tough one to clear). > And thanks to doing this I realized importlib is not stat'ing the > directory first which should fail faster than checking for the __init__ > files every time. That would explain why we had different ideas as to what the interpreter was doing :) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia --------------------------------------------------------------- _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com