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

Mike Meyer mwm at mired.org
Thu Nov 15 02:30:07 CET 2012


On Wed, Nov 14, 2012 at 5:51 PM, Jim Jewett <jimjjewett at gmail.com> wrote:
> On 11/12/12, Ben Hoyt <benhoyt at gmail.com> wrote:
[...]
> (c)  Attributes will default to None, supporting the "if x is None:
> x=stat()" pattern for the users who do care about attributes that were
> not available quickly.  (If there is an attribute for which "None" is
> actually meaningful, the user can use hasattr -- but that is a corner
> case, not worth polluting the API for.)

Two questions:

1) Is there some way to distinguish that your st_mode field is only
partially there (i.e. - you get the Linux/BSD d_type value, but not
the rest of st_mode)?

2) How about making these attributes properties, so that touching one
that isn't there causes them all to be populated.

     <mike



More information about the Python-ideas mailing list