[Python-checkins] python/dist/src/Doc/lib libos.tex,1.145,1.146

tim_one at users.sourceforge.net tim_one at users.sourceforge.net
Mon Nov 22 17:53:48 CET 2004

Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24459/Doc/lib

Modified Files:
Log Message:
os.walk():  Changed the "sum of bytes consumed by files" example to use
a generator expression instead of a listcomp.

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

Index: libos.tex
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -d -r1.145 -r1.146
--- libos.tex	22 Nov 2004 16:49:02 -0000	1.145
+++ libos.tex	22 Nov 2004 16:53:46 -0000	1.146
@@ -1174,7 +1174,7 @@
 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

More information about the Python-checkins mailing list