]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
save match function instead of regexp object
authorGuido van Rossum <guido@python.org>
Fri, 16 Aug 1991 13:24:42 +0000 (13:24 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 16 Aug 1991 13:24:42 +0000 (13:24 +0000)
Lib/grep.py
Lib/lib-old/grep.py

index 210f9f008a14db3cd285ab83092cc4b07cbd85f3..767498bd3229f2d424bb584c965a3ca091e75dd0 100644 (file)
@@ -4,14 +4,14 @@ import regexp
 import string
 
 def grep(expr, filename):
-       prog = regexp.compile(expr)
+       match = regexp.compile(expr).match
        fp = open(filename, 'r')
        lineno = 0
        while 1:
                line = fp.readline()
                if not line: break
                lineno = lineno + 1
-               res = prog.exec(line)
+               res = match(line)
                if res:
                        #print res
                        start, end = res[0]
index 210f9f008a14db3cd285ab83092cc4b07cbd85f3..767498bd3229f2d424bb584c965a3ca091e75dd0 100644 (file)
@@ -4,14 +4,14 @@ import regexp
 import string
 
 def grep(expr, filename):
-       prog = regexp.compile(expr)
+       match = regexp.compile(expr).match
        fp = open(filename, 'r')
        lineno = 0
        while 1:
                line = fp.readline()
                if not line: break
                lineno = lineno + 1
-               res = prog.exec(line)
+               res = match(line)
                if res:
                        #print res
                        start, end = res[0]