Martin v. Löwis wrote: > a) the directory cache is out of date, and you should > re-read the directory > b) the module still isn't there, but is available in > a later directory on sys.path (which hasn't yet > been visited) > c) the module isn't there at all, and the import will > eventually fail. > > How can the interpreter determine which of these it > is?
It doesn't need to - if there is no file for the module in the cache, it assumes that the cache could be out of date and rebuilds it. If that turns up a file, then fine, else the module doesn't exist. BTW, I'm not thinking of cacheing individual directories, but scanning all the directories and building a single qualified_module_name -> pathname mapping. If the cache gets invalidated, all the directories along the path are re-scanned, so a new module will be picked up wherever it is on the path. -- Greg _______________________________________________ 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