benhoyt/betterwalk — pull request #4 by adam-silkey (2013-01-24 02:11:22+00:00)
Title: Updating walk() with a stats option

I added an option fifth parameter (stats=False) to your walk function which will enable people to take advantage of the stat gathering from iterdir_stat().

If stats=True, this will change the generator from
> yield top, dirs, nondirs

To:
> yield top, zip(dirs, dir_stats), zip(nondirs, nondir_stats)

As a usage example, using stats=True will enable someone to quickly total up the size of a all items in a folder without duplicating work or creating a parallel function. Additionally, the parameter maintains backwards compatibility with the standard os.walk API.