A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-May/126166.html below:

[Python-Dev] Issue 11406: adding os.scandir(), a directory iterator returning stat-like info

[Python-Dev] Issue 11406: adding os.scandir(), a directory iterator returning stat-like infoBen Hoyt benhoyt at gmail.com
Mon May 13 02:24:16 CEST 2013
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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4