The fts interface from BSD is simpler to use than Python's os.walk for most cases. It's also more flexible, it provides more information, and it requires far fewer calls to stat, making it inherently faster (around 3x-7x on tests on different platforms) for many use cases.
Never mind…
As pointed out by Nick Coghlan, a generator expression translates the argument of the outermost for clause into the argument to the generator function, not a local within the generator function.
As pointed out by Nick Coghlan, a generator expression translates the argument of the outermost for clause into the argument to the generator function, not a local within the generator function.