[Python-Dev] statcache.lstat?

Skip Montanaro skip@pobox.com (Skip Montanaro)
Wed, 31 Oct 2001 19:01:06 -0600


    >> I can use os.lstat (or os.stat) directly.  I'm working on a file
    >> selector widget written in Python (and PyGtk).  As people traverse
    >> the directory tree, it seems to make sense to cache the stat results.

    Guido> But why bother?  And why not let them see changes in the
    Guido> filesystem?

File selector goodies peek at all files in a directory, even the stuff you
don't care about, at the very least to segregate them into directory and
non-directory files.  Caching stat info would probably help speed them up.
I was trying to speed things up a bit and saw statcache.  I had been using
os.stat and os.lstat, so it was natural to wonder about the absence of
statcache.lstat.  Maybe it's best to simply rely on the underlying operating
system's caching.

    >> If statcache is indeed a failed experiment, perhaps it should be
    >> deprecated. 

    Guido> Fine with me.

Here's a proposed addition to PEP 4:

    Module name:   statcache
    Rationale:     Of limited usefulness and complicates the life of the
                   application programmer, who must manage the cache.  Not
                   widely used by other core libraries (they use
                   os.stat instead). Also, it is not thread-safe.
    Date:          31-Oct-2001
    Documentation: TBD

Just say the word and I'll update it and submit a patch for the
documentation. 

Oh, and congratulations on the imminent arrival.  You will kill for a nice
nap in a couple weeks. ;-)

Skip