a generator expression instead of a listcomp.
Not a backport candidate (genexps are new in 2.4).
from os.path import join, getsize
for root, dirs, files in os.walk('python/Lib/email'):
print root, "consumes",
- print sum([getsize(join(root, name)) for name in files]),
+ print sum(getsize(join(root, name)) for name in files),
print "bytes in", len(files), "non-directory files"
if 'CVS' in dirs:
dirs.remove('CVS') # don't visit CVS directories