On Mon, May 13, 2013 at 12:11 PM, Victor Stinner
<victor.stin...@gmail.com> wrote:
> 2013/5/13 Ben Hoyt <benh...@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
_______________________________________________
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

Reply via email to