Commit dff84043 authored by Guido van Rossum's avatar Guido van Rossum

save match function instead of regexp object

parent 14d53bf1
......@@ -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]
......
......@@ -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]
......
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