Commit d494418f authored by Tim Peters's avatar Tim Peters

Heh -- I checked in an old version of this, at a time I documented the

internal read() as being a generator but hadn't yet changed it into one.
parent 76d11f4e
...@@ -74,13 +74,11 @@ import sys ...@@ -74,13 +74,11 @@ import sys
# (when whilematch is false), is lost, and fileiter will resume at the line # (when whilematch is false), is lost, and fileiter will resume at the line
# following it. # following it.
def read(fileiter, pat, whilematch): def read(fileiter, pat, whilematch):
result = []
for line in fileiter: for line in fileiter:
if bool(pat.match(line)) == whilematch: if bool(pat.match(line)) == whilematch:
result.append(line) yield line
else: else:
break break
return result
def combine(fname): def combine(fname):
f = file(fname) f = file(fname)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment