[Python-ideas] BetterWalk, a better and faster os.walk() for Python
John Mulligan
phlogistonjohn at asynchrono.us
Sun Nov 25 14:46:54 CET 2012
> On Sunday, November 25, 2012 01:47:05 PM Nick Coghlan wrote:
>
> > On Sun, Nov 25, 2012 at 9:27 AM, Andrew Barnert <abarnert at yahoo.com>
wrote:
> >
> > This can only be implemented on platforms that support the *at functions.
I
> > believe that means just linux and OpenBSD right now, other *BSD (including
OS X)
> > at some unspecified point in the future. Putting something like that in the
> > stdlib would probably require also adding another function like
os_supports_at
> > (similar to supports_fd, supports_dirfd, etc.), but that's not a big deal.
> >
>
> FWIW, if "supports_dirfd" is non-empty, you can be pretty sure that the
underlying OS supports the *at APIs, as that's how the dirfd argument gets
used by the affected functions.
>
When I realized that Python 3.3 listdir already supports a file descriptor
argument I had to go back to the docs and read this section over again! I have
not used Python 3 in anger yet so even though I've read the new docs before I
find it easy to overlook things.
This means that (for my use cases at least) all that Python 3.3 is missing are
the extra pieces of data in the direntry structure. I don't know if anyone
else is interested in this particular low-level feature but if we were to come
up with an interface that works well for both posix/windows I think the
os.walk case (both walk and fwalk now) is much easier to deal with.
More information about the Python-ideas
mailing list