]> granicus.if.org Git - python/commitdiff
Heh -- I checked in an old version of this, at a time I documented the
authorTim Peters <tim.peters@gmail.com>
Fri, 18 Apr 2003 01:02:37 +0000 (01:02 +0000)
committerTim Peters <tim.peters@gmail.com>
Fri, 18 Apr 2003 01:02:37 +0000 (01:02 +0000)
internal read() as being a generator but hadn't yet changed it into one.

Tools/scripts/combinerefs.py

index 3fafd9b2431e2eebaf98a27909cbdf19e8db52bb..edd1a860a5d7092804f5e71a707d62485130fad9 100644 (file)
@@ -74,13 +74,11 @@ import sys
 # (when whilematch is false), is lost, and fileiter will resume at the line
 # following it.
 def read(fileiter, pat, whilematch):
-    result = []
     for line in fileiter:
         if bool(pat.match(line)) == whilematch:
-            result.append(line)
+            yield line
         else:
             break
-    return result
 
 def combine(fname):
     f = file(fname)