]> granicus.if.org Git - python/commitdiff
os.walk(): Changed the "sum of bytes consumed by files" example to use
authorTim Peters <tim.peters@gmail.com>
Mon, 22 Nov 2004 16:53:46 +0000 (16:53 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 22 Nov 2004 16:53:46 +0000 (16:53 +0000)
a generator expression instead of a listcomp.

Not a backport candidate (genexps are new in 2.4).

Doc/lib/libos.tex

index 91923c443add06a026ed962f80d7118328bd94e1..402f6782adeb3fd20034bfafc9893b49a2836c98 100644 (file)
@@ -1174,7 +1174,7 @@ import os
 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