Mercurial > hg
diff tests/md5sum.py @ 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 | 6a98f9408a50 |
children | 3a64ac39b893 |
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))