[Python-ideas] BetterWalk, a better and faster os.walk() for Python

Jim Jewett jimjjewett at gmail.com
Tue Nov 27 16:23:03 CET 2012

On 11/26/12, Ben Hoyt <benhoyt at gmail.com> quoted (random?) as writing:
>> I'm suspicious of your use of Windows' built-in pattern matching. ...
>> ... for example: it matches short filenames,
>> ... ["?" at the end of a name means an *optional* any character]
>> ... the behavior of patterns ending in ".*" or "." isn't like fnmatch.

So?  Consistency would be better, but that horse left before the barn
was even built.  It is called filename "globbing" because even the
wild inconsistency between regular expression implementations
doesn't quite encompass most file globbing rules.

I'll grant that better documentation would be nice.  But at this point,
matching the platform expectation (at the cost of some additional
cross-platform inconsistency) may be the lesser of evils.

And frankly, for many use cases the windows algorithm is better.

It only hurts when it brings up something you weren't expecting *and*
you didn't double-check before performing a dangerous operation.
I can assure that I've found unexpected file matches under unix
semantics as well.


More information about the Python-ideas mailing list