On Mon, 13 Jun 2005 01:25:51 -0400, "Phillip J. Eby" <pje at telecommunity.com> wrote: >At 09:01 PM 6/12/2005 -0700, Guido van Rossum wrote: >>If we have to do this, PEP 315 has my +0. >> >>It is Pythonically minimal and the motivation rings true: I've often >>written code like this in the past: >> >> line = f.readline() >> while line: >> <do something> >> line = f.readline() >> >>But these days we do that using "for line in f". > >Block-copying a file with read() has the same pattern (e.g. in shutil), but >you can't make it a for loop. Anything can be a for loop. for chunk in iter(lambda: f1.read(CHUNK_SIZE), ''): f2.write(chunk) Jp
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4