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

Ben Hoyt benhoyt at gmail.com
Thu Nov 29 21:10:13 CET 2012

> 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.

So you're proposing that the "pattern" argument is passed directly to
FindFirstFile as the wildcard on Windows, and to Python's fnmatch on
Linux? That's not terrible, but there is the "my program deleted files
it shouldn't have" problem for edge cases.

Isn't fnmatch's behaviour quite well defined? I think if it's not too
difficult it'd be better to mimic that (emulating "bad patterns" using
fnmatch where necessary on Windows).


More information about the Python-ideas mailing list