[Python-Dev] Issue 11406: adding os.scandir(), a directory iterator returning stat-like info (original) (raw)
Ben Hoyt benhoyt at gmail.com
Mon May 13 02:24:16 CEST 2013
- Previous message: [Python-Dev] Issue 11406: adding os.scandir(), a directory iterator returning stat-like info
- Next message: [Python-Dev] Issue 11406: adding os.scandir(), a directory iterator returning stat-like info
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, May 13, 2013 at 12:11 PM, Victor Stinner <victor.stinner at gmail.com> wrote:
2013/5/13 Ben Hoyt <benhoyt at gmail.com>:
class DirEntry: ... def lstat(self): if self.lstat is None: self.lstat = os.lstat(os.path.join(self.path, self.name)) return self.lstat ... You need to provide a way to invalidate the stat cache, DirEntry.clearcache() for example.
Hmm, I'm not sure why, as the stat result is cached on the DirEntry instance (not the class). If you don't want the cached version, just call os.stat() yourself, or throw away the DirEntry instance. DirEntry instances would just be used for dealing with scandir() results.
-Ben
- Previous message: [Python-Dev] Issue 11406: adding os.scandir(), a directory iterator returning stat-like info
- Next message: [Python-Dev] Issue 11406: adding os.scandir(), a directory iterator returning stat-like info
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]