$NetBSD: patch-aa,v 1.3 2009/07/06 21:42:38 joerg Exp $

--- mx/TextTools/TextTools.py.orig	2009-07-06 21:37:44.000000000 +0000
+++ mx/TextTools/TextTools.py
@@ -167,7 +167,7 @@ def word_in_list(l):
 # Extra stuff useful in combination with the C functions
 #
 
-def replace(text,what,with,start=0,stop=None,
+def replace(text,what,with_,start=0,stop=None,
 
             SearchObject=BMS,join=join,joinlist=joinlist,tag=tag,
             string_replace=string.replace,type=type,
@@ -188,11 +188,11 @@ def replace(text,what,with,start=0,stop=
         what = so.match
     if stop is None:
         if start == 0 and len(what) < 2:
-            return string_replace(text,what,with)
+            return string_replace(text,what,with_)
         stop = len(text)
     t = ((text,sWordStart,so,+2),
          # Found something, replace and continue searching
-         (with,Skip+AppendTagobj,len(what),-1,-1),
+         (with_,Skip+AppendTagobj,len(what),-1,-1),
          # Rest of text
          (text,Move,ToEOF)
          )
@@ -203,7 +203,7 @@ def replace(text,what,with,start=0,stop=
 
 # Alternative (usually slower) versions using different techniques:
 
-def _replace2(text,what,with,start=0,stop=None,
+def _replace2(text,what,with_,start=0,stop=None,
 
               join=join,joinlist=joinlist,tag=tag,
               StringType=types.StringType,BMS=BMS):
@@ -222,13 +222,13 @@ def _replace2(text,what,with,start=0,sto
         stop = len(text)
     if type(what) == StringType:
         what=BMS(what)
-    t = ((with,sFindWord,what,+1,+0),)
+    t = ((with_,sFindWord,what,+1,+0),)
     found,taglist,last = tag(text,t,start,stop)
     if not found: 
         return text
     return join(joinlist(text,taglist))
 
-def _replace3(text,what,with,
+def _replace3(text,what,with_,
 
               join=string.join,FS=FS,
               StringType=types.StringType):
@@ -241,12 +241,12 @@ def _replace3(text,what,with,
     l = []
     x = 0
     for left,right in slices:
-        l.append(text[x:left] + with)
+        l.append(text[x:left] + with_)
         x = right
     l.append(text[x:])
     return join(l,'')
 
-def _replace4(text,what,with,
+def _replace4(text,what,with_,
 
               join=join,joinlist=joinlist,tag=tag,FS=FS,
               StringType=types.StringType):
@@ -258,7 +258,7 @@ def _replace4(text,what,with,
         return text
     repl = [None]*len(slices)
     for i in range(len(slices)):
-        repl[i] = (with,)+slices[i]
+        repl[i] = (with_,)+slices[i]
     return join(joinlist(text,repl))
 
 def multireplace(text,replacements,start=0,stop=None,
@@ -554,16 +554,16 @@ def _bench(file='mxTextTools/mxTextTools
         print 'Replacing strings'
         print '-'*72
         print
-        for what,with in (('m','M'),('mx','MX'),('mxText','MXTEXT'),
+        for what,with_ in (('m','M'),('mx','MX'),('mxText','MXTEXT'),
                           ('hmm','HMM'),('hmmm','HMM'),('hmhmm','HMM')):
-            print 'Replace "%s" with "%s"' % (what,with)
+            print 'Replace "%s" with "%s"' % (what,with_)
             t.start()
             for i in range(100):
-                rtext = string.replace(text,what,with)
+                rtext = string.replace(text,what,with_)
             print 'with string.replace:',t.stop(),'sec.'
             t.start()
             for i in range(100):
-                ttext = replace(text,what,with)
+                ttext = replace(text,what,with_)
             print 'with tag.replace:',t.stop(),'sec.'
             if ttext != rtext:
                 print 'results are NOT ok !'
@@ -571,7 +571,7 @@ def _bench(file='mxTextTools/mxTextTools
                 mismatch(rtext,ttext)
             t.start()
             for i in range(100):
-                ttext = _replace2(text,what,with)
+                ttext = _replace2(text,what,with_)
             print 'with tag._replace2:',t.stop(),'sec.'
             if ttext != rtext:
                 print 'results are NOT ok !'
@@ -579,7 +579,7 @@ def _bench(file='mxTextTools/mxTextTools
                 print rtext
             t.start()
             for i in range(100):
-                ttext = _replace3(text,what,with)
+                ttext = _replace3(text,what,with_)
             print 'with tag._replace3:',t.stop(),'sec.'
             if ttext != rtext:
                 print 'results are NOT ok !'
@@ -587,7 +587,7 @@ def _bench(file='mxTextTools/mxTextTools
                 print rtext
             t.start()
             for i in range(100):
-                ttext = _replace4(text,what,with)
+                ttext = _replace4(text,what,with_)
             print 'with tag._replace4:',t.stop(),'sec.'
             if ttext != rtext:
                 print 'results are NOT ok !'
