summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-08-16 13:24:42 (GMT)
committerGuido van Rossum <guido@python.org>1991-08-16 13:24:42 (GMT)
commitdff84043e4431a3dfec55e386a1f35e76815adee (patch)
tree2b6b04145391ff92850bf9cfcf9fec4ff4f302d9 /Lib
parent14d53bf16428be47eaaea4ca25bc816d70f90a2b (diff)
downloadcpython-dff84043e4431a3dfec55e386a1f35e76815adee.zip
cpython-dff84043e4431a3dfec55e386a1f35e76815adee.tar.gz
cpython-dff84043e4431a3dfec55e386a1f35e76815adee.tar.bz2
save match function instead of regexp object
Diffstat (limited to 'Lib')
-rw-r--r--Lib/grep.py4
-rw-r--r--Lib/lib-old/grep.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/Lib/grep.py b/Lib/grep.py
index 210f9f0..767498b 100644
--- a/Lib/grep.py
+++ b/Lib/grep.py
@@ -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]
diff --git a/Lib/lib-old/grep.py b/Lib/lib-old/grep.py
index 210f9f0..767498b 100644
--- a/Lib/lib-old/grep.py
+++ b/Lib/lib-old/grep.py
@@ -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]