[Python-Dev] Import redesign [LONG]

Skip Montanaro skip@mojam.com (Skip Montanaro)
Fri, 19 Nov 1999 16:11:38 -0600 (CST)


    Greg> The problem occurs when you path is [A, B], the file is in B, and
    Greg> you add something to A on-the-fly. The cache might direct the
    Greg> importer at B, missing your file.

Typically your path will be relatively short (< 20 directories), right?
Just stat the directories before consulting the cache.  If any changed since
the last time the cache was built, then invalidate the entire cache (or that
portion of the cached information that is downstream from the first modified
directory).  It's still going to be cheaper than performing listdir for each
directory in the path, and like you said, only require flushes during
development or installation actions.

Skip Montanaro | http://www.mojam.com/
skip@mojam.com | http://www.musi-cal.com/
847-971-7098   | Python: Programming the way Guido indented...