changeset 29731:8d1cdee372e6

md5sum: use `iter(callable, sentinel)` instead of while True This is functionally equivalent, but is a little more concise.
author Augie Fackler <augie@google.com>
date Fri, 05 Aug 2016 14:00:56 -0400
parents 4d23cd6e2219
children 0806fa2a39d8
files tests/md5sum.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/md5sum.py	Fri Aug 05 14:00:46 2016 -0400
+++ b/tests/md5sum.py	Fri Aug 05 14:00:56 2016 -0400
@@ -34,10 +34,7 @@
 
     m = md5()
     try:
-        while True:
-            data = fp.read(8192)
-            if not data:
-                break
+        for data in iter(lambda: fp.read(8192), ''):
             m.update(data)
     except IOError as msg:
         sys.stderr.write('%s: I/O error: %s\n' % (filename, msg))