[Python-ideas] Speed up os.walk() 5x to 9x by using file attributes from FindFirst/NextFile() and readdir()

Ronald Oussoren ronaldoussoren at mac.com
Tue Nov 13 08:07:32 CET 2012

On 12 Nov, 2012, at 10:17, Ben Hoyt <benhoyt at gmail.com> wrote:
> This means that on Linux/BSD/Mac OS X it'd return a stat_result with
> st_mode set but the other fields None, on Windows it'd basically
> return the full stat_result, and on other systems it'd return
> (filename, None).

Where would st_mode be retrieved from?  The readdir(3) interface
only provides d_type (and that field is not in POSIX or SUS).

The d_type field contains a file type, and while you could use that
to construct a value for st_mode that can be used to test the file
type, you cannot reconstruct the file permissions from that.


More information about the Python-ideas mailing list