[Numpy-svn] r4330 - in trunk/numpy: core core/code_generators distutils f2py f2py/doc f2py/tests/mixed oldnumeric

numpy-svn@scip... numpy-svn@scip...
Mon Oct 29 09:38:45 CDT 2007


Author: jarrod.millman
Date: 2007-10-29 09:37:37 -0500 (Mon, 29 Oct 2007)
New Revision: 4330

Modified:
   trunk/numpy/core/code_generators/generate_umath.py
   trunk/numpy/core/defchararray.py
   trunk/numpy/core/defmatrix.py
   trunk/numpy/distutils/ccompiler.py
   trunk/numpy/distutils/misc_util.py
   trunk/numpy/f2py/auxfuncs.py
   trunk/numpy/f2py/capi_maps.py
   trunk/numpy/f2py/cb_rules.py
   trunk/numpy/f2py/common_rules.py
   trunk/numpy/f2py/crackfortran.py
   trunk/numpy/f2py/doc/collectinput.py
   trunk/numpy/f2py/f2py2e.py
   trunk/numpy/f2py/f90mod_rules.py
   trunk/numpy/f2py/func2subr.py
   trunk/numpy/f2py/rules.py
   trunk/numpy/f2py/tests/mixed/run.py
   trunk/numpy/f2py/use_rules.py
   trunk/numpy/oldnumeric/matrix.py
   trunk/numpy/oldnumeric/precision.py
Log:
using faster string methods rather than deprecated string module


Modified: trunk/numpy/core/code_generators/generate_umath.py
===================================================================
--- trunk/numpy/core/code_generators/generate_umath.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/core/code_generators/generate_umath.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -1,4 +1,3 @@
-import string
 import re
 
 Zero = "PyUFunc_Zero"
@@ -484,7 +483,7 @@
 
 def indent(st,spaces):
     indention = ' '*spaces
-    indented = indention + string.replace(st,'\n','\n'+indention)
+    indented = indention + st.replace('\n','\n'+indention)
     # trim off any trailing spaces
     indented = re.sub(r' +$',r'',indented)
     return indented

Modified: trunk/numpy/core/defchararray.py
===================================================================
--- trunk/numpy/core/defchararray.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/core/defchararray.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -1,7 +1,7 @@
+import sys
 from numerictypes import string_, unicode_, integer, object_
 from numeric import ndarray, broadcast, empty, compare_chararrays
 from numeric import array as narray
-import sys
 
 __all__ = ['chararray']
 

Modified: trunk/numpy/core/defmatrix.py
===================================================================
--- trunk/numpy/core/defmatrix.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/core/defmatrix.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -1,9 +1,8 @@
 __all__ = ['matrix', 'bmat', 'mat', 'asmatrix']
 
+import sys
 import numeric as N
 from numeric import concatenate, isscalar, binary_repr
-import string as str_
-import sys
 
 # make translation table
 _table = [None]*256
@@ -11,8 +10,7 @@
     _table[k] = chr(k)
 _table = ''.join(_table)
 
-_numchars = str_.digits + ".-+jeEL"
-del str_
+_numchars = '0123456789.-+jeEL'
 _todelete = []
 for k in _table:
     if k not in _numchars:

Modified: trunk/numpy/distutils/ccompiler.py
===================================================================
--- trunk/numpy/distutils/ccompiler.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/distutils/ccompiler.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -400,7 +400,8 @@
 ccompiler.gen_preprocess_options = gen_preprocess_options
 
 ##Fix distutils.util.split_quoted:
-import re,string
+import re
+import string
 _wordchars_re = re.compile(r'[^\\\'\"%s ]*' % string.whitespace)
 _squote_re = re.compile(r"'(?:[^'\\]|\\.)*'")
 _dquote_re = re.compile(r'"(?:[^"\\]|\\.)*"')

Modified: trunk/numpy/distutils/misc_util.py
===================================================================
--- trunk/numpy/distutils/misc_util.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/distutils/misc_util.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -5,7 +5,6 @@
 import copy
 import glob
 import atexit
-import string
 import tempfile
 
 try:
@@ -1524,8 +1523,8 @@
         Possible results are "Intel", "Itanium", or "AMD64".
         """
         prefix = " bit ("
-        i = string.find(sys.version, prefix)
+        i = sys.version.find(prefix)
         if i == -1:
             return "Intel"
-        j = string.find(sys.version, ")", i)
+        j = sys.version.find(")", i)
         return sys.version[i+len(prefix):j]

Modified: trunk/numpy/f2py/auxfuncs.py
===================================================================
--- trunk/numpy/f2py/auxfuncs.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/f2py/auxfuncs.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -19,7 +19,10 @@
 f2py_version = __version__.version
 
 import pprint
-import sys,string,time,types,os
+import sys
+import time
+import types
+import os
 import cfuncs
 
 
@@ -254,13 +257,13 @@
     for i in range(len(f)):
         l='%s,f%d=f[%d]'%(l,i,i)
         l2.append('f%d(v)'%(i))
-    return eval('%s:%s'%(l,string.join(l2,' and ')))
+    return eval('%s:%s'%(l,' and '.join(l2)))
 def l_or(*f):
     l,l2='lambda v',[]
     for i in range(len(f)):
         l='%s,f%d=f[%d]'%(l,i,i)
         l2.append('f%d(v)'%(i))
-    return eval('%s:%s'%(l,string.join(l2,' or ')))
+    return eval('%s:%s'%(l,' or '.join(l2)))
 def l_not(f):
     return eval('lambda v,f=f:not f(v)')
 
@@ -340,7 +343,7 @@
                 arg_types2.append('size_t')
         arg_types.append(ctype)
 
-    proto_args = string.join(arg_types+arg_types2,',')
+    proto_args = ','.join(arg_types+arg_types2)
     if not proto_args:
         proto_args = 'void'
     #print proto_args
@@ -411,9 +414,9 @@
         else:
             sep=defaultsep
         if type(dict[k])==types.ListType:
-            str=string.replace(str,'#%s#'%(k),string.join(flatlist(dict[k]),sep))
+            str=str.replace('#%s#'%(k),sep.join(flatlist(dict[k])))
         else:
-            str=string.replace(str,'#%s#'%(k),dict[k])
+            str=str.replace('#%s#'%(k),dict[k])
     return str
 
 def dictappend(rd,ar):

Modified: trunk/numpy/f2py/capi_maps.py
===================================================================
--- trunk/numpy/f2py/capi_maps.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/f2py/capi_maps.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -16,7 +16,9 @@
 import __version__
 f2py_version = __version__.version
 
-import string,copy,re,os
+import copy
+import re
+import os
 from auxfuncs import *
 from crackfortran import markoutercomma
 import cb_rules
@@ -170,8 +172,8 @@
         f.close()
         for k,d1 in d.items():
             for k1 in d1.keys():
-                d1[string.lower(k1)] = d1[k1]
-            d[string.lower(k)] = d[k]
+                d1[k1.lower()] = d1[k1]
+            d[k.lower()] = d[k]
         for k in d.keys():
             if not f2cmap_all.has_key(k): f2cmap_all[k]={}
             for k1 in d[k].keys():
@@ -217,8 +219,8 @@
         else: errmess('getctype: function %s has no return value?!\n'%a)
     elif issubroutine(var):
         return ctype
-    elif var.has_key('typespec') and f2cmap_all.has_key(string.lower(var['typespec'])):
-        typespec = string.lower(var['typespec'])
+    elif var.has_key('typespec') and f2cmap_all.has_key(var['typespec'].lower()):
+        typespec = var['typespec'].upper()
         f2cmap=f2cmap_all[typespec]
         ctype=f2cmap[''] # default type
         if var.has_key('kindselector'):
@@ -279,10 +281,10 @@
 #         if not isintent_c(var):
 #             var['dimension'].reverse()
         dim=copy.copy(var['dimension'])
-        ret['size']=string.join(dim,'*')
+        ret['size']='*'.join(dim)
         try: ret['size']=`eval(ret['size'])`
         except: pass
-        ret['dims']=string.join(dim,',')
+        ret['dims']=','.join(dim)
         ret['rank']=`len(dim)`
         ret['rank*[-1]']=`len(dim)*[-1]`[1:-1]
         for i in range(len(dim)): # solve dim for dependecies
@@ -359,13 +361,13 @@
         rank=`len(dim)`
         sig='%s :%s %s rank-%s array(\'%s\') with bounds (%s)'%(a,init,opt,rank,
                                              c2pycode_map[ctype],
-                                             string.join(dim,','))
+                                             ','.join(dim))
         if a==out_a:
             sigout='%s : rank-%s array(\'%s\') with bounds (%s)'\
-                    %(a,rank,c2pycode_map[ctype],string.join(dim,','))
+                    %(a,rank,c2pycode_map[ctype],','.join(dim))
         else:
             sigout='%s : rank-%s array(\'%s\') with bounds (%s) and %s storage'\
-                    %(out_a,rank,c2pycode_map[ctype],string.join(dim,','),a)
+                    %(out_a,rank,c2pycode_map[ctype],','.join(dim),a)
     elif isexternal(var):
         ua=''
         if lcb_map.has_key(a) and lcb2_map.has_key(lcb_map[a]) and lcb2_map[lcb_map[a]].has_key('argname'):
@@ -389,7 +391,7 @@
         rank=`len(dim)`
         sig='%s : rank-%s array(\'%s\') with bounds (%s)'%(a,rank,
                                                            c2pycode_map[ctype],
-                                                           string.join(dim,','))
+                                                           ','.join(dim))
     return sig
 
 def getinit(a,var):
@@ -404,7 +406,7 @@
             try:
                 v = var["="]
                 if ',' in v:
-                    ret['init.r'],ret['init.i']=string.split(markoutercomma(v[1:-1]),'@,@')
+                    ret['init.r'],ret['init.i']=markoutercomma(v[1:-1]).split('@,@')
                 else:
                     v = eval(v,{},{})
                     ret['init.r'],ret['init.i']=str(v.real),str(v.imag)
@@ -414,7 +416,7 @@
         elif isstring(var):
             if not init: init,showinit='""',"''"
             if init[0]=="'":
-                init='"%s"'%(string.replace(init[1:-1],'"','\\"'))
+                init='"%s"'%(init[1:-1].replace('"','\\"'))
             if init[0]=='"': showinit="'%s'"%(init[1:-1])
     return init,showinit
 
@@ -440,7 +442,7 @@
         if f(var): intent_flags.append('F2PY_%s'%s)
     if intent_flags:
         #XXX: Evaluate intent_flags here.
-        ret['intent'] = string.join(intent_flags,'|')
+        ret['intent'] = '|'.join(intent_flags)
     else:
         ret['intent'] = 'F2PY_INTENT_IN'
     if isarray(var): ret['varrformat']='N'
@@ -449,7 +451,7 @@
     else: ret['varrformat']='O'
     ret['init'],ret['showinit']=getinit(a,var)
     if hasinitvalue(var) and iscomplex(var) and not isarray(var):
-        ret['init.r'],ret['init.i'] = string.split(markoutercomma(ret['init'][1:-1]),'@,@')
+        ret['init.r'],ret['init.i'] = markoutercomma(ret['init'][1:-1]).split('@,@')
     if isexternal(var):
         ret['cbnamekey']=a
         if lcb_map.has_key(a):
@@ -491,14 +493,14 @@
         if isarray(var):
 #             if not isintent_c(var):
 #                 var['dimension'].reverse()
-            ddim=string.join(map(lambda x,y:'%s|%s'%(x,y),var['dimension'],dim),',')
+            ddim=','.join(map(lambda x,y:'%s|%s'%(x,y),var['dimension'],dim))
             rl.append('dims(%s)'%ddim)
 #             if not isintent_c(var):
 #                 var['dimension'].reverse()
         if isexternal(var):
-            ret['vardebuginfo']='debug-capi:%s=>%s:%s'%(a,ret['cbname'],string.join(rl,','))
+            ret['vardebuginfo']='debug-capi:%s=>%s:%s'%(a,ret['cbname'],','.join(rl))
         else:
-            ret['vardebuginfo']='debug-capi:%s %s=%s:%s'%(ret['ctype'],a,ret['showinit'],string.join(rl,','))
+            ret['vardebuginfo']='debug-capi:%s %s=%s:%s'%(ret['ctype'],a,ret['showinit'],','.join(rl))
         if isscalar(var):
             if cformat_map.has_key(ret['ctype']):
                 ret['vardebugshowvalue']='debug-capi:%s=%s'%(a,cformat_map[ret['ctype']])
@@ -526,13 +528,13 @@
     name = rout['name']
     fname = getfortranname(rout)
     ret={'name':name,
-         'texname':string.replace(name,'_','\\_'),
-         'name_lower':string.lower(name),
-         'NAME':string.upper(name),
+         'texname':name.replace('_','\\_'),
+         'name_lower':name.lower(),
+         'NAME':name.upper(),
          'begintitle':gentitle(name),
          'endtitle':gentitle('end of %s'%name),
          'fortranname':fname,
-         'FORTRANNAME':string.upper(fname),
+         'FORTRANNAME':fname.upper(),
          'callstatement':getcallstatement(rout) or '',
          'usercode':getusercode(rout) or '',
          'usercode1':getusercode1(rout) or '',
@@ -595,12 +597,12 @@
     """
     if ismodule(m):
         ret={'f90modulename':m['name'],
-             'F90MODULENAME':string.upper(m['name']),
-             'texf90modulename':string.replace(m['name'],'_','\\_')}
+             'F90MODULENAME':m['name'].upper(),
+             'texf90modulename':m['name'].replace('_','\\_')}
     else:
         ret={'modulename':m['name'],
-             'MODULENAME':string.upper(m['name']),
-             'texmodulename':string.replace(m['name'],'_','\\_')}
+             'MODULENAME':m['name'].upper(),
+             'texmodulename':m['name'].replace('_','\\_')}
     ret['restdoc'] = getrestdoc(m) or []
     if hasnote(m):
         ret['note']=m['note']

Modified: trunk/numpy/f2py/cb_rules.py
===================================================================
--- trunk/numpy/f2py/cb_rules.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/f2py/cb_rules.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -20,7 +20,10 @@
 
 
 import pprint
-import sys,string,time,types,copy
+import sys
+import time
+import types
+import copy
 errmess=sys.stderr.write
 outmess=sys.stdout.write
 show=pprint.pprint
@@ -484,8 +487,8 @@
                                    {'docsign':rd['docsign'],
                                     'docsignopt':optargs,
                                     })
-    rd['latexdocsignature']=string.replace(rd['docsignature'],'_','\\_')
-    rd['latexdocsignature']=string.replace(rd['latexdocsignature'],',',', ')
+    rd['latexdocsignature']=rd['docsignature'].replace('_','\\_')
+    rd['latexdocsignature']=rd['latexdocsignature'].replace(',',', ')
     rd['docstrsigns']=[]
     rd['latexdocstrsigns']=[]
     for k in ['docstrreq','docstropt','docstrout','docstrcbs']:

Modified: trunk/numpy/f2py/common_rules.py
===================================================================
--- trunk/numpy/f2py/common_rules.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/f2py/common_rules.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -19,7 +19,10 @@
 f2py_version = __version__.version
 
 import pprint
-import sys,string,time,types,copy
+import sys
+import time
+import types
+import copy
 errmess=sys.stderr.write
 outmess=sys.stdout.write
 show=pprint.pprint
@@ -63,24 +66,24 @@
     doc = ['']
     def dadd(line,s=doc): s[0] = '%s\n%s'%(s[0],line)
     for (name,vnames,vars) in findcommonblocks(m):
-        lower_name = string.lower(name)
+        lower_name = name.lower()
         hnames,inames = [],[]
         for n in vnames:
             if isintent_hide(vars[n]): hnames.append(n)
             else: inames.append(n)
         if hnames:
-            outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t  %s\n\t\t  Hidden: %s\n'%(name,string.join(inames,','),string.join(hnames,',')))
+            outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t  %s\n\t\t  Hidden: %s\n'%(name,','.join(inames),','.join(hnames)))
         else:
-            outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t  %s\n'%(name,string.join(inames,',')))
+            outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t  %s\n'%(name,','.join(inames)))
         fadd('subroutine f2pyinit%s(setupfunc)'%name)
         fadd('external setupfunc')
         for n in vnames:
             fadd(func2subr.var2fixfortran(vars,n))
         if name=='_BLNK_':
-            fadd('common %s'%(string.join(vnames,',')))
+            fadd('common %s'%(','.join(vnames)))
         else:
-            fadd('common /%s/ %s'%(name,string.join(vnames,',')))
-        fadd('call setupfunc(%s)'%(string.join(inames,',')))
+            fadd('common /%s/ %s'%(name,','.join(vnames)))
+        fadd('call setupfunc(%s)'%(','.join(inames)))
         fadd('end\n')
         cadd('static FortranDataDef f2py_%s_def[] = {'%(name))
         idims=[]
@@ -90,12 +93,12 @@
             dm = capi_maps.getarrdims(n,vars[n])
             if dm['dims']: idims.append('(%s)'%(dm['dims']))
             else: idims.append('')
-            dms=string.strip(dm['dims'])
+            dms=dm['dims'].strip()
             if not dms: dms='-1'
             cadd('\t{\"%s\",%s,{{%s}},%s},'%(n,dm['rank'],dms,at))
         cadd('\t{NULL}\n};')
         inames1 = rmbadname(inames)
-        inames1_tps = string.join(map(lambda s:'char *'+s,inames1),',')
+        inames1_tps = ','.join(map(lambda s:'char *'+s,inames1))
         cadd('static void f2py_setup_%s(%s) {'%(name,inames1_tps))
         cadd('\tint i_f2py=0;')
         for n in inames1:
@@ -106,24 +109,24 @@
         else:
             F_FUNC='F_FUNC'
         cadd('extern void %s(f2pyinit%s,F2PYINIT%s)(void(*)(%s));'\
-             %(F_FUNC,lower_name,string.upper(name),
-               string.join(['char*']*len(inames1),',')))
+             %(F_FUNC,lower_name,name.upper(),
+               ','.join(['char*']*len(inames1))))
         cadd('static void f2py_init_%s(void) {'%name)
         cadd('\t%s(f2pyinit%s,F2PYINIT%s)(f2py_setup_%s);'\
-             %(F_FUNC,lower_name,string.upper(name),name))
+             %(F_FUNC,lower_name,name.upper(),name))
         cadd('}\n')
         iadd('\tF2PyDict_SetItemString(d, \"%s\", PyFortranObject_New(f2py_%s_def,f2py_init_%s));'%(name,name,name))
-        tname = string.replace(name,'_','\\_')
+        tname = name.replace('_','\\_')
         dadd('\\subsection{Common block \\texttt{%s}}\n'%(tname))
         dadd('\\begin{description}')
         for n in inames:
             dadd('\\item[]{{}\\verb@%s@{}}'%(capi_maps.getarrdocsign(n,vars[n])))
             if hasnote(vars[n]):
                 note = vars[n]['note']
-                if type(note) is type([]): note=string.join(note,'\n')
+                if type(note) is type([]): note='\n'.join(note)
                 dadd('--- %s'%(note))
         dadd('\\end{description}')
-        ret['docs'].append('"\t/%s/ %s\\n"'%(name,string.join(map(lambda v,d:v+d,inames,idims),',')))
+        ret['docs'].append('"\t/%s/ %s\\n"'%(name,','.join(map(lambda v,d:v+d,inames,idims))))
     ret['commonhooks']=chooks
     ret['initcommonhooks']=ihooks
     ret['latexdoc']=doc[0]

Modified: trunk/numpy/f2py/crackfortran.py
===================================================================
--- trunk/numpy/f2py/crackfortran.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/f2py/crackfortran.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -15,6 +15,7 @@
 __version__ = "$Revision: 1.177 $"[10:-1]
 
 import __version__
+import string
 f2py_version = __version__.version
 
 """
@@ -143,7 +144,13 @@
      The above may be solved by creating appropriate preprocessor program, for example.
 """
 #
-import sys,string,fileinput,re,pprint,os,copy
+import sys
+import string
+import fileinput
+import re
+import pprint
+import os
+import copy
 from auxfuncs import *
 
 # Global flags:
@@ -222,7 +229,7 @@
 def undo_rmbadname(names): return map(undo_rmbadname1,names)
 
 def getextension(name):
-    i=string.rfind(name,'.')
+    i=name.rfind('.')
     if i==-1: return ''
     if '\\' in name[i:]: return ''
     if '/' in name[i:]: return ''
@@ -307,7 +314,7 @@
                     %(`currentfilename`,sourcecodeform,
                       strictf77 and ',strict' or ''))
 
-        l=string.expandtabs(l).replace('\xa0',' ')
+        l=l.expandtabs().replace('\xa0',' ')
         while not l=='':                       # Get rid of newline characters
             if l[-1] not in "\n\r\f": break
             l=l[:-1]
@@ -316,17 +323,17 @@
             if r:
                 l=r.group('line')+' ' # Strip comments starting with `!'
                 rl=r.group('rest')
-                if string.lower(rl[:4])=='f2py': # f2py directive
+                if rl[:4].lower()=='f2py': # f2py directive
                     l = l + 4*' '
                     r=commentline.match(rl[4:])
                     if r: l=l+r('line')
                     else: l = l + rl[4:]
-        if string.strip(l)=='': # Skip empty line
+        if l.strip()=='': # Skip empty line
             cont=0
             continue
         if sourcecodeform=='fix':
             if l[0] in ['*','c','!','C','#']:
-                if string.lower(l[1:5])=='f2py': # f2py directive
+                if l[1:5].lower()=='f2py': # f2py directive
                     l='     '+l[5:]
                 else: # Skip comment line
                     cont=0
@@ -352,14 +359,14 @@
                         origfinalline=''
                     else:
                         l='     '+l[5:] # clean up line beginning from possible digits.
-                        if localdolowercase: finalline=string.lower(ll)
+                        if localdolowercase: finalline=ll.lower()
                         else: finalline=ll
                         origfinalline=ll
                         ll=l
                     cont=(r is not None)
                 else:
                     l='     '+l[5:] # clean up line beginning from possible digits.
-                    if localdolowercase: finalline=string.lower(ll)
+                    if localdolowercase: finalline=ll.lower()
                     else: finalline=ll
                     origfinalline =ll
                     ll=l
@@ -383,7 +390,7 @@
                 finalline=''
                 origfinalline=''
             else:
-                if localdolowercase: finalline=string.lower(ll)
+                if localdolowercase: finalline=ll.lower()
                 else: finalline=ll
                 origfinalline =ll
                 ll=l
@@ -411,7 +418,7 @@
             dowithline(finalline)
         l1=ll
     if localdolowercase:
-        finalline=string.lower(ll)
+        finalline=ll.lower()
     else: finalline=ll
     origfinalline = ll
     filepositiontext='Line #%d in %s:"%s"\n\t' % (fin.filelineno()-1,currentfilename,l1)
@@ -482,11 +489,11 @@
 
 def _simplifyargs(argsline):
     a = []
-    for n in string.split(markoutercomma(argsline),'@,@'):
+    for n in markoutercomma(argsline).split('@,@'):
         for r in '(),':
-            n = string.replace(n,r,'_')
+            n = n.replace(r,'_')
         a.append(n)
-    return string.join(a,',')
+    return ','.join(a)
 
 crackline_re_1 = re.compile(r'\s*(?P<result>\b[a-z]+[\w]*\b)\s*[=].*',re.I)
 def crackline(line,reset=0):
@@ -650,7 +657,7 @@
     assert not f,`f,line,l,cc`
     return l
 def unmarkouterparen(line):
-    r = string.replace(string.replace(line,'@(@','('),'@)@',')')
+    r = line.replace('@(@','(').replace('@)@',')')
     return r
 def appenddecl(decl,decl2,force=1):
     if not decl: decl={}
@@ -706,7 +713,7 @@
         previous_context = None
     if expectbegin and case not in ['begin','call','callfun','type'] \
        and not skipemptyends and groupcounter<1:
-        newname=string.split(os.path.basename(currentfilename),'.')[0]
+        newname=os.path.basename(currentfilename).split('.')[0]
         outmess('analyzeline: no group yet. Creating program group with name "%s".\n'%newname)
         gotnextfile=0
         groupcounter=groupcounter+1
@@ -734,7 +741,7 @@
                 outmess('analyzeline: No name/args pattern found for line.\n')
 
         previous_context = (block,name,groupcounter)
-        if args: args=rmbadname(map(string.strip,string.split(markoutercomma(args),'@,@')))
+        if args: args=rmbadname([x.strip() for x in markoutercomma(args).split('@,@')])
         else: args=[]
         if '' in args:
             while '' in args:
@@ -851,7 +858,7 @@
         name,args,result=_resolvenameargspattern(m.group('after'))
         if name is not None:
             if args:
-                args=rmbadname(map(string.strip,string.split(markoutercomma(args),'@,@')))
+                args=rmbadname([x.strip() for x in markoutercomma(args).strip('@,@')])
             else: args=[]
             assert result is None,`result`
             groupcache[groupcounter]['entry'][name] = args
@@ -864,22 +871,22 @@
     elif case in ['dimension','intent','optional','required','external','public','private','intrisic']:
         edecl=groupcache[groupcounter]['vars']
         ll=m.group('after').strip()
-        i=string.find(ll,'::')
+        i=ll.find('::')
         if i<0 and case=='intent':
-            i=string.find(markouterparen(ll),'@)@')-2
+            i=markouterparen(ll).find('@)@')-2
             ll=ll[:i+1]+'::'+ll[i+1:]
-            i=string.find(ll,'::')
+            i=ll.find('::')
             if ll[i:]=='::' and groupcache[groupcounter].has_key('args'):
                 outmess('All arguments will have attribute %s%s\n'%(m.group('this'),ll[:i]))
-                ll = ll + string.join(groupcache[groupcounter]['args'],',')
+                ll = ll + ','.join(groupcache[groupcounter]['args'])
         if i<0:i=0;pl=''
-        else: pl=string.strip(ll[:i]);ll=ll[i+2:]
-        ch = string.split(markoutercomma(pl),'@,@')
+        else: pl=ll[:i].strip();ll=ll[i+2:]
+        ch = markoutercomma(pl).split('@,@')
         if len(ch)>1:
             pl = ch[0]
             outmess('analyzeline: cannot handle multiple attributes without type specification. Ignoring %r.\n' % (','.join(ch[1:])))
         last_name = None
-        for e in map(string.strip,string.split(markoutercomma(ll),'@,@')):
+        for e in [x.strip() for x in markoutercomma(ll).split('@,@')]:
             m1=namepattern.match(e)
             if not m1:
                 if case in ['public','private']: k=''
@@ -896,8 +903,7 @@
                 if _intentcallbackpattern.match(ap):
                     if k not in groupcache[groupcounter]['args']:
                         if groupcounter>1 and \
-                               string.find(groupcache[groupcounter-2]['name'],
-                                           '__user__')==-1:
+                               '__user__' in groupcache[groupcounter-2]['name']:
                             outmess('analyzeline: appending intent(callback) %s'\
                                     ' to %s arguments\n' % (k,groupcache[groupcounter]['name']))
                             groupcache[groupcounter]['args'].append(k)
@@ -923,11 +929,11 @@
             previous_context = ('variable',last_name,groupcounter)
     elif case=='parameter':
         edecl=groupcache[groupcounter]['vars']
-        ll=string.strip(m.group('after'))[1:-1]
+        ll=m.group('after').strip()[1:-1]
         last_name = None
-        for e in string.split(markoutercomma(ll),'@,@'):
+        for e in markoutercomma(ll).split('@,@'):
             try:
-                k,initexpr=map(string.strip,string.split(e,'='))
+                k,initexpr=[x.strip() for x in e.split('=')]
             except:
                 outmess('analyzeline: could not extract name,expr in parameter statement "%s" of "%s"\n'%(e,ll));continue
             params = get_parameters(edecl)
@@ -942,7 +948,7 @@
                     for m in real16pattern.finditer(initexpr):
                         tt[m.start():m.end()] = list(\
                             initexpr[m.start():m.end()].lower().replace('d', 'e'))
-                    initexpr = "".join(tt)
+                    initexpr = ''.join(tt)
                 elif t.get('typespec')=='complex':
                     initexpr = initexpr[1:].lower().replace('d','e').\
                                replace(',','+1j*(')
@@ -961,7 +967,7 @@
         if last_name is not None:
             previous_context = ('variable',last_name,groupcounter)
     elif case=='implicit':
-        if string.lower(string.strip(m.group('after')))=='none':
+        if m.group('after').strip().lower()=='none':
             groupcache[groupcounter]['implicit']=None
         elif m.group('after'):
             if groupcache[groupcounter].has_key('implicit'):
@@ -970,7 +976,7 @@
             if impl is None:
                 outmess('analyzeline: Overwriting earlier "implicit none" statement.\n')
                 impl={}
-            for e in string.split(markoutercomma(m.group('after')),'@,@'):
+            for e in markoutercomma(m.group('after')).split('@,@'):
                 decl={}
                 m1=re.match(r'\s*(?P<this>.*?)\s*(\(\s*(?P<after>[a-z-, ]+)\s*\)\s*|)\Z',e,re.I)
                 if not m1:
@@ -986,12 +992,12 @@
                 decl['typename']=typename
                 for k in decl.keys():
                     if not decl[k]: del decl[k]
-                for r in string.split(markoutercomma(m1.group('after')),'@,@'):
+                for r in markoutercomma(m1.group('after')).split('@,@'):
                     if '-' in r:
-                        try: begc,endc=map(string.strip,string.split(r,'-'))
+                        try: begc,endc=[x.strip() for x in r.split('-')]
                         except:
                             outmess('analyzeline: expected "<char>-<char>" instead of "%s" in range list of implicit statement\n'%r);continue
-                    else: begc=endc=string.strip(r)
+                    else: begc=endc=r.strip()
                     if not len(begc)==len(endc)==1:
                         outmess('analyzeline: expected "<char>-<char>" instead of "%s" in range list of implicit statement (2)\n'%r);continue
                     for o in range(ord(begc),ord(endc)+1):
@@ -1024,7 +1030,7 @@
             vars=groupcache[groupcounter]['vars']
         last_name = None
         for l in ll:
-            l=map(string.strip,l)
+            l=[x.strip() for x in l]
             if l[0][0]==',':l[0]=l[0][1:]
             if l[0][0]=='(':
                 outmess('analyzeline: implied-DO list "%s" is not supported. Skipping.\n'%l[0])
@@ -1033,7 +1039,7 @@
             #    #outmess('analyzeline: ignoring this data statement.\n')
             #    continue
             i=0;j=0;llen=len(l[1])
-            for v in rmbadname(map(string.strip,string.split(markoutercomma(l[0]),'@,@'))):
+            for v in rmbadname([x.strip() for x in markoutercomma(l[0]).split('@,@')]):
                 if v[0]=='(':
                     outmess('analyzeline: implied-DO list "%s" is not supported. Skipping.\n'%v)
                     # XXX: subsequent init expressions may get wrong values.
@@ -1056,20 +1062,20 @@
         if last_name is not None:
             previous_context = ('variable',last_name,groupcounter)
     elif case=='common':
-        line=string.strip(m.group('after'))
+        line=m.group('after').strip()
         if not line[0]=='/':line='//'+line
         cl=[]
         f=0;bn='';ol=''
         for c in line:
             if c=='/':f=f+1;continue
             if f>=3:
-                bn = string.strip(bn)
+                bn = bn.strip()
                 if not bn: bn='_BLNK_'
                 cl.append([bn,ol])
                 f=f-2;bn='';ol=''
             if f%2: bn=bn+c
             else: ol=ol+c
-        bn = string.strip(bn)
+        bn = bn.strip()
         if not bn: bn='_BLNK_'
         cl.append([bn,ol])
         commonkey={}
@@ -1080,7 +1086,7 @@
                 outmess('analyzeline: previously defined common block encountered. Skipping.\n')
                 continue
             commonkey[c[0]]=[]
-            for i in map(string.strip,string.split(markoutercomma(c[1]),'@,@')):
+            for i in [x.strip() for x in markoutercomma(c[1]).split('@,@')]:
                 if i: commonkey[c[0]].append(i)
         groupcache[groupcounter]['common']=commonkey
         previous_context = ('common',bn,groupcounter)
@@ -1095,12 +1101,12 @@
             if mm.has_key('list') and mm['list'] is not None:
                 if mm.has_key('notonly') and mm['notonly'] is None:isonly=1
                 groupcache[groupcounter]['use'][name]['only']=isonly
-                ll=map(string.strip,string.split(mm['list'],','))
+                ll=[x.strip() for x in mm['list'].split(',')]
                 rl={}
                 for l in ll:
                     if '=' in l:
                         m2=re.match(r'\A\s*(?P<local>\b[\w]+\b)\s*=\s*>\s*(?P<use>\b[\w]+\b)\s*\Z',l,re.I)
-                        if m2: rl[string.strip(m2.group('local'))]=string.strip(m2.group('use'))
+                        if m2: rl[m2.group('local').strip()]=m2.group('use').strip()
                         else:
                             outmess('analyzeline: Not local=>use pattern found in %s\n'%`l`)
                     else:
@@ -1151,7 +1157,7 @@
     attr=None
     if re.match(r'double\s*complex',typespec,re.I): typespec='double complex'
     elif re.match(r'double\s*precision',typespec,re.I): typespec='double precision'
-    else: typespec=string.lower(string.strip(typespec))
+    else: typespec=typespec.strip().lower()
     m1=selectpattern.match(markouterparen(ll))
     if not m1:
         outmess('cracktypespec0: no kind/char_selector pattern found for line.\n')
@@ -1161,9 +1167,9 @@
     if typespec in ['complex','integer','logical','real','character','type']:
         selector=d['this']
         ll=d['after']
-    i=string.find(ll,'::')
+    i=ll.find('::')
     if i>=0:
-        attr=string.strip(ll[:i])
+        attr=ll[:i].strip()
         ll=ll[i+2:]
     return typespec,selector,attr,ll
 #####
@@ -1173,7 +1179,7 @@
 lenkindpattern=re.compile(r'\s*(kind\s*=\s*(?P<kind>.*?)\s*(@,@\s*len\s*=\s*(?P<len>.*)|)|(len\s*=\s*|)(?P<len2>.*?)\s*(@,@\s*(kind\s*=\s*|)(?P<kind2>.*)|))\s*\Z',re.I)
 lenarraypattern=re.compile(r'\s*(@\(@\s*(?!/)\s*(?P<array>.*?)\s*@\)@\s*[*]\s*(?P<len>.*?)|([*]\s*(?P<len2>.*?)|)\s*(@\(@\s*(?!/)\s*(?P<array2>.*?)\s*@\)@|))\s*(=\s*(?P<init>.*?)|(@\(@|)/\s*(?P<init2>.*?)\s*/(@\)@|)|)\s*\Z',re.I)
 def removespaces(expr):
-    expr=string.strip(expr)
+    expr=expr.strip()
     if len(expr)<=1: return expr
     expr2=expr[0]
     for i in range(1,len(expr)-1):
@@ -1203,21 +1209,21 @@
     last_name = None
     kindselect,charselect,typename=cracktypespec(typespec,selector)
     if attrspec:
-        attrspec=map(string.strip,string.split(markoutercomma(attrspec),'@,@'))
+        attrspec=[x.strip() for x in markoutercomma(attrspec).split('@,@')]
         l = []
         c = re.compile(r'(?P<start>[a-zA-Z]+)')
         for a in attrspec:
             m = c.match(a)
             if m:
-                s = string.lower(m.group('start'))
+                s = m.group('start').lower()
                 a = s + a[len(s):]
             l.append(a)
         attrspec = l
-    el=map(string.strip,string.split(markoutercomma(entitydecl),'@,@'))
+    el=[x.strip() for x in markoutercomma(entitydecl).split('@,@')]
     el1=[]
     for e in el:
-        for e1 in map(string.strip,string.split(markoutercomma(removespaces(markinnerspaces(e)),comma=' '),'@ @')):
-            if e1: el1.append(string.replace(e1,'@_@',' '))
+        for e1 in [x.strip() for x in markoutercomma(removespaces(markinnerspaces(e)),comma=' ').split('@ @')]:
+            if e1: el1.append(e1.replace('@_@',' '))
     for e in el1:
         m=namepattern.match(e)
         if not m:
@@ -1430,7 +1436,7 @@
     if not usedict:
         return param_map
     for usename,mapping in usedict.items():
-        usename = string.lower(usename)
+        usename = usename.lower()
         if not f90modulevars.has_key(usename):
             continue
         mvars = f90modulevars[usename]
@@ -1594,7 +1600,7 @@
             if i>n:
                 errmess('sortvarnames: failed to compute dependencies because'
                         ' of cyclic dependencies between '
-                        +string.join(dep,', ')+'\n')
+                        +', '.join(dep)+'\n')
                 indep = indep + dep
                 break
         else:
@@ -1615,16 +1621,16 @@
             if m:
                 dims=[]
                 if m.group('dims'):
-                    dims=map(string.strip,string.split(markoutercomma(m.group('dims')),'@,@'))
-                n=string.strip(m.group('name'))
+                    dims=[x.strip() for x in markoutercomma(m.group('dims')).split('@,@')]
+                n=m.group('name').strip()
                 if block['vars'].has_key(n):
                     if block['vars'][n].has_key('attrspec'):
-                        block['vars'][n]['attrspec'].append('dimension(%s)'%(string.join(dims,',')))
+                        block['vars'][n]['attrspec'].append('dimension(%s)'%(','.join(dims)))
                     else:
-                        block['vars'][n]['attrspec']=['dimension(%s)'%(string.join(dims,','))]
+                        block['vars'][n]['attrspec']=['dimension(%s)'%(','.join(dims))]
                 else:
                     if dims:
-                        block['vars'][n]={'attrspec':['dimension(%s)'%(string.join(dims,','))]}
+                        block['vars'][n]={'attrspec':['dimension(%s)'%(','.join(dims))]}
                     else: block['vars'][n]={}
                 if n not in commonvars: commonvars.append(n)
             else:
@@ -1657,7 +1663,7 @@
         if b['block']=='interface' and not b['body']:
             if not b.has_key('f2pyenhancements'):
                 continue
-        if string.replace(b['block'],' ','')=='pythonmodule':
+        if b['block'].replace(' ','')=='pythonmodule':
             usermodules.append(b)
         else:
             if b['block']=='module':
@@ -1926,7 +1932,7 @@
                 for m in real16pattern.finditer(v):
                     tt[m.start():m.end()] = list(\
                             v[m.start():m.end()].lower().replace('d', 'e'))
-                v = string.join(tt,'')
+                v = ''.join(tt)
             if iscomplex(vars[n]):
                 if v[0]=='(' and v[-1]==')':
                     l = markoutercomma(v[1:-1]).split('@,@')
@@ -1939,7 +1945,7 @@
                 outmess('get_parameters: got "%s" on %s\n' % (msg,`v`))
             if isstring(vars[n]) and type(params[n]) is type(0):
                 params[n] = chr(params[n])
-            nl = string.lower(n)
+            nl = n.lower()
             if nl!=n:
                 params[nl] = params[n]
         else:
@@ -2011,7 +2017,7 @@
         if not vars[n].has_key('typespec'):
             if not(vars[n].has_key('attrspec') and 'external' in vars[n]['attrspec']):
                 if implicitrules:
-                    ln0 = string.lower(n[0])
+                    ln0 = n[0].lower()
                     for k in implicitrules[ln0].keys():
                         if k=='typespec' and implicitrules[ln0][k]=='undefined':
                             continue
@@ -2048,39 +2054,39 @@
             vars[n]['attrspec']=[]
             dim,intent,depend,check,note=None,None,None,None,None
             for a in attr:
-                if a[:9]=='dimension': dim=(string.strip(a[9:]))[1:-1]
-                elif a[:6]=='intent': intent=(string.strip(a[6:]))[1:-1]
-                elif a[:6]=='depend': depend=(string.strip(a[6:]))[1:-1]
-                elif a[:5]=='check': check=(string.strip(a[5:]))[1:-1]
-                elif a[:4]=='note': note=(string.strip(a[4:]))[1:-1]
+                if a[:9]=='dimension': dim=(a[9:].strip())[1:-1]
+                elif a[:6]=='intent': intent=(a[6:].strip())[1:-1]
+                elif a[:6]=='depend': depend=(a[6:].strip())[1:-1]
+                elif a[:5]=='check': check=(a[5:].strip())[1:-1]
+                elif a[:4]=='note': note=(a[4:].strip())[1:-1]
                 else: vars[n]=setattrspec(vars[n],a)
                 if intent:
                     if not vars[n].has_key('intent'): vars[n]['intent']=[]
-                    for c in map(string.strip,string.split(markoutercomma(intent),'@,@')):
+                    for c in [x.strip() for x in markoutercomma(intent).split('@,@')]:
                         if not c in vars[n]['intent']:
                             vars[n]['intent'].append(c)
                     intent=None
                 if note:
-                    note=string.replace(note,'\\n\\n','\n\n')
-                    note=string.replace(note,'\\n ','\n')
+                    note=note.replace('\\n\\n','\n\n')
+                    note=note.replace('\\n ','\n')
                     if not vars[n].has_key('note'): vars[n]['note']=[note]
                     else: vars[n]['note'].append(note)
                     note=None
                 if depend is not None:
                     if not vars[n].has_key('depend'): vars[n]['depend']=[]
-                    for c in rmbadname(map(string.strip,string.split(markoutercomma(depend),'@,@'))):
+                    for c in rmbadname([x.strip() for x in markoutercomma(depend).split('@,@')]):
                         if c not in vars[n]['depend']:
                             vars[n]['depend'].append(c)
                     depend=None
                 if check is not None:
                     if not vars[n].has_key('check'): vars[n]['check']=[]
-                    for c in map(string.strip,string.split(markoutercomma(check),'@,@')):
+                    for c in [x.strip() for x in markoutercomma(check).split('@,@')]:
                         if not c in vars[n]['check']:
                             vars[n]['check'].append(c)
                     check=None
             if dim and not vars[n].has_key('dimension'):
                 vars[n]['dimension']=[]
-                for d in rmbadname(map(string.strip,string.split(markoutercomma(dim),'@,@'))):
+                for d in rmbadname([x.strip() for x in markoutercomma(dim).split('@,@')]):
                     star = '*'
                     if d==':': star=':'
                     if params.has_key(d):
@@ -2093,7 +2099,7 @@
                     if d==star:
                         dl = [star]
                     else:
-                        dl=string.split(markoutercomma(d,':'),'@:@')
+                        dl=markoutercomma(d,':').split('@:@')
                     if len(dl)==2 and '*' in dl: # e.g. dimension(5:*)
                         dl = ['*']
                         d = '*'
@@ -2153,7 +2159,7 @@
                         if vars[d].has_key('attrspec'):
                             for aa in vars[d]['attrspec']:
                                 if aa[:6]=='depend':
-                                    ddeps=ddeps+string.split((string.strip(aa[6:]))[1:-1],',')
+                                    ddeps += aa[6:].strip()[1:-1].split(',')
                         if vars[d].has_key('depend'):
                             ddeps=ddeps+vars[d]['depend']
                     i=i+1
@@ -2223,9 +2229,9 @@
                     vars[n]=appenddecl(vars[n],vars[block['result']])
                 if block.has_key('prefix'):
                     pr=block['prefix']; ispure=0; isrec=1
-                    pr1=string.replace(pr,'pure','')
+                    pr1=pr.replace('pure','')
                     ispure=(not pr==pr1)
-                    pr=string.replace(pr1,'recursive','')
+                    pr=pr1.replace('recursive','')
                     isrec=(not pr==pr1)
                     m=typespattern[0].match(pr)
                     if m:
@@ -2332,7 +2338,7 @@
 def determineexprtype(expr,vars,rules={}):
     if vars.has_key(expr):
         return _ensure_exprdict(vars[expr])
-    expr=string.strip(expr)
+    expr=expr.strip()
     if determineexprtype_re_1.match(expr):
         return {'typespec':'complex'}
     m=determineexprtype_re_2.match(expr)
@@ -2346,7 +2352,7 @@
             outmess('determineexprtype: selected kind types not supported (%s)\n'%`expr`)
         return {'typespec':'real'}
     for op in ['+','-','*','/']:
-        for e in map(string.strip,string.split(markoutercomma(expr,comma=op),'@'+op+'@')):
+        for e in [x.strip() for x in markoutercomma(expr,comma=op).split('@'+op+'@')]:
             if vars.has_key(e):
                 return _ensure_exprdict(vars[e])
     t={}
@@ -2391,7 +2397,7 @@
         vars = block['vars']
         al = [a for a in block['args'] if not isintent_callback(vars[a])]
         if block['block']=='function' or al:
-            args='(%s)'%string.join(al,',')
+            args='(%s)'%','.join(al)
     f2pyenhancements = ''
     if block.has_key('f2pyenhancements'):
         for k in block['f2pyenhancements'].keys():
@@ -2402,7 +2408,7 @@
     if intent_lst:
         f2pyenhancements = '%s%sintent(%s) %s'%\
                            (f2pyenhancements,tab+tabchar,
-                            string.join(intent_lst,','),name)
+                            ','.join(intent_lst),name)
     use=''
     if block.has_key('use'):
         use=use2fortran(block['use'],tab+tabchar)
@@ -2425,7 +2431,7 @@
         entry_stmts = ''
         for k,i in block['entry'].items():
             entry_stmts = '%s%sentry %s(%s)' \
-                          % (entry_stmts,tab+tabchar,k,string.join(i,','))
+                          % (entry_stmts,tab+tabchar,k,','.join(i))
         body = body + entry_stmts
     if blocktype=='block data' and name=='_BLOCK_DATA_':
         name = ''
@@ -2435,9 +2441,9 @@
     ret=''
     for k in common.keys():
         if k=='_BLNK_':
-            ret='%s%scommon %s'%(ret,tab,string.join(common[k],','))
+            ret='%s%scommon %s'%(ret,tab,','.join(common[k]))
         else:
-            ret='%s%scommon /%s/ %s'%(ret,tab,k,string.join(common[k],','))
+            ret='%s%scommon /%s/ %s'%(ret,tab,k,','.join(common[k]))
     return ret
 def use2fortran(use,tab=''):
     ret=''
@@ -2546,23 +2552,23 @@
                 if l not in ['external']:
                     attr.append(l)
             if attr:
-                vardef='%s %s'%(vardef,string.join(attr,','))
+                vardef='%s %s'%(vardef,','.join(attr))
                 c=','
         if vars[a].has_key('dimension'):
 #             if not isintent_c(vars[a]):
 #                 vars[a]['dimension'].reverse()
-            vardef='%s%sdimension(%s)'%(vardef,c,string.join(vars[a]['dimension'],','))
+            vardef='%s%sdimension(%s)'%(vardef,c,','.join(vars[a]['dimension']))
             c=','
         if vars[a].has_key('intent'):
             lst = true_intent_list(vars[a])
             if lst:
-                vardef='%s%sintent(%s)'%(vardef,c,string.join(lst,','))
+                vardef='%s%sintent(%s)'%(vardef,c,','.join(lst))
             c=','
         if vars[a].has_key('check'):
-            vardef='%s%scheck(%s)'%(vardef,c,string.join(vars[a]['check'],','))
+            vardef='%s%scheck(%s)'%(vardef,c,','.join(vars[a]['check']))
             c=','
         if vars[a].has_key('depend'):
-            vardef='%s%sdepend(%s)'%(vardef,c,string.join(vars[a]['depend'],','))
+            vardef='%s%sdepend(%s)'%(vardef,c,','.join(vars[a]['depend']))
             c=','
         if vars[a].has_key('='):
             v = vars[a]['=']

Modified: trunk/numpy/f2py/doc/collectinput.py
===================================================================
--- trunk/numpy/f2py/doc/collectinput.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/f2py/doc/collectinput.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -22,7 +22,11 @@
 __version__ = "0.0"
 
 stdoutflag=0
-import sys,os,string,fileinput,re,commands
+import sys
+import os
+import fileinput
+import re
+import commands
 
 try: fn=sys.argv[2]
 except:
@@ -46,7 +50,7 @@
         l=l[:m.end()-1]
     m=input.match(l)
     if m:
-        l=string.strip(l)
+        l=l.strip()
         if l[-1]=='}': l=l[:-1]
         i=m.end()-2
         sys.stderr.write('>>>>>>')

Modified: trunk/numpy/f2py/f2py2e.py
===================================================================
--- trunk/numpy/f2py/f2py2e.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/f2py/f2py2e.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -18,7 +18,12 @@
 import __version__
 f2py_version = __version__.version
 
-import sys,os,string,pprint,shutil,types,re
+import sys
+import os
+import pprint
+import shutil
+import types
+import re
 errmess=sys.stderr.write
 #outmess=sys.stdout.write
 show=pprint.pprint
@@ -301,7 +306,7 @@
     ret = {}
     for i in range(len(mnames)):
         if isusedby.has_key(mnames[i]):
-            outmess('\tSkipping module "%s" which is used by %s.\n'%(mnames[i],string.join(map(lambda s:'"%s"'%s,isusedby[mnames[i]]),',')))
+            outmess('\tSkipping module "%s" which is used by %s.\n'%(mnames[i],','.join(map(lambda s:'"%s"'%s,isusedby[mnames[i]]))))
         else:
             um=[]
             if modules[i].has_key('use'):
@@ -341,10 +346,10 @@
                 if not isusedby.has_key(u): isusedby[u]=[]
                 isusedby[u].append(postlist[i]['name'])
     for i in range(len(postlist)):
-        if postlist[i]['block']=='python module' and string.find(postlist[i]['name'],'__user__')<0:
+        if postlist[i]['block']=='python module' and '__user__' in postlist[i]['name']:
             if isusedby.has_key(postlist[i]['name']):
                 #if not quiet:
-                outmess('Skipping Makefile build for module "%s" which is used by %s\n'%(postlist[i]['name'],string.join(map(lambda s:'"%s"'%s,isusedby[postlist[i]['name']]),',')))
+                outmess('Skipping Makefile build for module "%s" which is used by %s\n'%(postlist[i]['name'],','.join(map(lambda s:'"%s"'%s,isusedby[postlist[i]['name']]))))
     if options.has_key('signsfile'):
         if options['verbose']>1:
             outmess('Stopping. Edit the signature file and then run f2py on the signature file: ')
@@ -375,7 +380,7 @@
         ind = len(prefix)
     else:
         ind = 0
-    for file in map(string.strip,files):
+    for file in [x.strip() for x in files]:
         if match(file): filtered.append(file[ind:])
         else: rest.append(file)
     return filtered,rest
@@ -485,7 +490,7 @@
     using_numarray = 0
     using_numeric = 0
     for i in range(len(define_macros)):
-        name_value = string.split(define_macros[i],'=',1)
+        name_value = define_macros[i].split('=',1)
         if len(name_value)==1:
             name_value.append(None)
         if len(name_value)==2:

Modified: trunk/numpy/f2py/f90mod_rules.py
===================================================================
--- trunk/numpy/f2py/f90mod_rules.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/f2py/f90mod_rules.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -18,7 +18,10 @@
 f2py_version='See `f2py -v`'
 
 import pprint
-import sys,string,time,types,copy
+import sys
+import time
+import types
+import copy
 errmess=sys.stderr.write
 outmess=sys.stdout.write
 show=pprint.pprint
@@ -107,7 +110,7 @@
                 mfargs.append(n)
         outmess('\t\tConstructing F90 module support for "%s"...\n'%(m['name']))
         if onlyvars:
-            outmess('\t\t  Variables: %s\n'%(string.join(onlyvars)))
+            outmess('\t\t  Variables: %s\n'%(' '.join(onlyvars)))
         chooks=['']
         def cadd(line,s=chooks): s[0] = '%s\n%s'%(s[0],line)
         ihooks=['']
@@ -118,7 +121,7 @@
         dadd('\\subsection{Fortran 90/95 module \\texttt{%s}}\n'%(m['name']))
         if hasnote(m):
             note = m['note']
-            if type(note) is type([]): note=string.join(note,'\n')
+            if type(note) is type([]): note='\n'.join(note)
             dadd(note)
         if onlyvars:
             dadd('\\begin{description}')
@@ -128,8 +131,8 @@
             ct = capi_maps.getctype(var)
             at = capi_maps.c2capi_map[ct]
             dm = capi_maps.getarrdims(n,var)
-            dms = string.strip(string.replace(dm['dims'],'*','-1'))
-            dms = string.strip(string.replace(dms,':','-1'))
+            dms = dm['dims'].replace('*','-1').strip()
+            dms = dms.replace(':','-1').strip()
             if not dms: dms='-1'
             use_fgetdims2 = fgetdims2
             if isstringarray(var):
@@ -144,7 +147,7 @@
             dadd('\\item[]{{}\\verb@%s@{}}'%(capi_maps.getarrdocsign(n,var)))
             if hasnote(var):
                 note = var['note']
-                if type(note) is type([]): note=string.join(note,'\n')
+                if type(note) is type([]): note='\n'.join(note)
                 dadd('--- %s'%(note))
             if isallocatable(var):
                 fargs.append('f2py_%s_getdims_%s'%(m['name'],n))
@@ -157,7 +160,7 @@
                 fadd('integer flag\n')
                 fhooks[0]=fhooks[0]+fgetdims1
                 dms = eval('range(1,%s+1)'%(dm['rank']))
-                fadd(' allocate(d(%s))\n'%(string.join(map(lambda i:'s(%s)'%i,dms),',')))
+                fadd(' allocate(d(%s))\n'%(','.join(map(lambda i:'s(%s)'%i,dms))))
                 fhooks[0]=fhooks[0]+use_fgetdims2
                 fadd('end subroutine %s'%(fargs[-1]))
             else:
@@ -197,16 +200,16 @@
                 iadd('\tf2py_%s_def[i_f2py++].data = %s;'%(m['name'],b['name']))
         cadd('\t{NULL}\n};\n')
         iadd('}')
-        ihooks[0]='static void f2py_setup_%s(%s) {\n\tint i_f2py=0;%s'%(m['name'],string.join(sargs,','),ihooks[0])
+        ihooks[0]='static void f2py_setup_%s(%s) {\n\tint i_f2py=0;%s'%(m['name'],','.join(sargs),ihooks[0])
         if '_' in m['name']:
             F_FUNC='F_FUNC_US'
         else:
             F_FUNC='F_FUNC'
         iadd('extern void %s(f2pyinit%s,F2PYINIT%s)(void (*)(%s));'\
-             %(F_FUNC,m['name'],string.upper(m['name']),string.join(sargsp,',')))
+             %(F_FUNC,m['name'],m['name'].upper(),','.join(sargsp)))
         iadd('static void f2py_init_%s(void) {'%(m['name']))
         iadd('\t%s(f2pyinit%s,F2PYINIT%s)(f2py_setup_%s);'\
-             %(F_FUNC,m['name'],string.upper(m['name']),m['name']))
+             %(F_FUNC,m['name'],m['name'].upper(),m['name']))
         iadd('}\n')
         ret['f90modhooks']=ret['f90modhooks']+chooks+ihooks
         ret['initf90modhooks']=['\tPyDict_SetItemString(d, "%s", PyFortranObject_New(f2py_%s_def,f2py_init_%s));'%(m['name'],m['name'],m['name'])]+ret['initf90modhooks']
@@ -217,20 +220,20 @@
             for a in undo_rmbadname(mfargs):
                 fadd('use %s, only : %s'%(m['name'],a))
         if ifargs:
-            fadd(string.join(['interface']+ifargs))
+            fadd(' '.join(['interface']+ifargs))
             fadd('end interface')
         fadd('external f2pysetupfunc')
         if efargs:
             for a in undo_rmbadname(efargs):
                 fadd('external %s'%(a))
-        fadd('call f2pysetupfunc(%s)'%(string.join(undo_rmbadname(fargs),',')))
+        fadd('call f2pysetupfunc(%s)'%(','.join(undo_rmbadname(fargs))))
         fadd('end subroutine f2pyinit%s\n'%(m['name']))
 
-        dadd(string.replace(string.join(ret['latexdoc'],'\n'),r'\subsection{',r'\subsubsection{'))
+        dadd('\n'.join(ret['latexdoc']).replace(r'\subsection{',r'\subsubsection{'))
 
         ret['latexdoc']=[]
         ret['docs'].append('"\t%s --- %s"'%(m['name'],
-                                            string.join(undo_rmbadname(modobjs),',')))
+                                            ','.join(undo_rmbadname(modobjs))))
 
     ret['routine_defs']=''
     ret['doc']=[]

Modified: trunk/numpy/f2py/func2subr.py
===================================================================
--- trunk/numpy/f2py/func2subr.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/f2py/func2subr.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -17,8 +17,12 @@
 
 f2py_version='See `f2py -v`'
 
-import pprint,copy
-import sys,string,time,types,copy
+import pprint
+import copy
+import sys
+import time
+import types
+import copy
 errmess=sys.stderr.write
 outmess=sys.stdout.write
 show=pprint.pprint
@@ -69,7 +73,7 @@
 
     vardef='%s %s'%(vardef,fa)
     if vars[a].has_key('dimension'):
-        vardef='%s(%s)'%(vardef,string.join(vars[a]['dimension'],','))
+        vardef='%s(%s)'%(vardef,','.join(vars[a]['dimension']))
     return vardef
 
 def createfuncwrapper(rout,signature=0):
@@ -98,12 +102,12 @@
         if charselect.get('*','')=='(*)':
             charselect['*'] = '10'
     if f90mode:
-        sargs = string.join(args,', ')
+        sargs = ', '.join(args)
         add('subroutine f2pywrap_%s_%s (%s)'%(rout['modulename'],name,sargs))
         if not signature:
             add('use %s, only : %s'%(rout['modulename'],fortranname))
     else:
-        add('subroutine f2pywrap%s (%s)'%(name,string.join(args,', ')))
+        add('subroutine f2pywrap%s (%s)'%(name,', '.join(args)))
         add('external %s'%(fortranname))
         #if not return_char_star:
         l = l + ', '+fortranname
@@ -126,9 +130,9 @@
 
     if not signature:
         if islogicalfunction(rout):
-            add('%s = .not.(.not.%s(%s))'%(newname,fortranname,string.join(args,', ')))
+            add('%s = .not.(.not.%s(%s))'%(newname,fortranname,', '.join(args)))
         else:
-            add('%s = %s(%s)'%(newname,fortranname,string.join(args,', ')))
+            add('%s = %s(%s)'%(newname,fortranname,', '.join(args)))
     if f90mode:
         add('end subroutine f2pywrap_%s_%s'%(rout['modulename'],name))
     else:

Modified: trunk/numpy/f2py/rules.py
===================================================================
--- trunk/numpy/f2py/rules.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/f2py/rules.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -57,7 +57,10 @@
 f2py_version = __version__.version
 
 import pprint
-import sys,string,time,types,copy
+import sys
+import time
+import types
+import copy
 errmess=sys.stderr.write
 outmess=sys.stdout.write
 show=pprint.pprint
@@ -1166,7 +1169,7 @@
     fn = os.path.join(options['buildpath'],vrd['modulename']+'module.c')
     ret['csrc'] = fn
     f=open(fn,'w')
-    f.write(string.replace(ar['modulebody'],'\t',2*' '))
+    f.write(ar['modulebody'].replace('\t',2*' '))
     f.close()
     outmess('\tWrote C/API module "%s" to file "%s/%smodule.c"\n'%(m['name'],options['buildpath'],vrd['modulename']))
 
@@ -1174,7 +1177,7 @@
         fn = os.path.join(options['buildpath'],vrd['modulename']+'module.rest')
         f=open(fn,'w')
         f.write('.. -*- rest -*-\n')
-        f.write(string.join(ar['restdoc'],'\n'))
+        f.write('\n'.join(ar['restdoc']))
         f.close()
         outmess('\tReST Documentation is saved to file "%s/%smodule.rest"\n'%(options['buildpath'],vrd['modulename']))
     if options['dolatexdoc']:
@@ -1184,7 +1187,7 @@
         f.write('%% This file is auto-generated with f2py (version:%s)\n'%(f2py_version))
         if not options.has_key('shortlatex'):
             f.write('\\documentclass{article}\n\\usepackage{a4wide}\n\\begin{document}\n\\tableofcontents\n\n')
-        f.write(string.join(ar['latexdoc'],'\n'))
+        f.write('\n'.join(ar['latexdoc']))
         if not options.has_key('shortlatex'):
             f.write('\\end{document}')
         f.close()
@@ -1197,14 +1200,14 @@
         f.write('C     This file is autogenerated with f2py (version:%s)\n'%(f2py_version))
         f.write('C     It contains Fortran 77 wrappers to fortran functions.\n')
         lines = []
-        for l in string.split(string.join(funcwrappers,'\n\n')+'\n','\n'):
+        for l in '\n\n'.join(funcwrappers)+'\n'.split('\n'):
             if l and l[0]==' ':
                 while len(l)>=66:
                     lines.append(l[:66]+'\n     &')
                     l = l[66:]
                 lines.append(l+'\n')
             else: lines.append(l+'\n')
-        lines = string.join(lines,'').replace('\n     &\n','\n')
+        lines = ''.join(lines).replace('\n     &\n','\n')
         f.write(lines)
         f.close()
         outmess('\tFortran 77 wrappers are saved to "%s"\n'%(wn))
@@ -1216,7 +1219,7 @@
         f.write('!     This file is autogenerated with f2py (version:%s)\n'%(f2py_version))
         f.write('!     It contains Fortran 90 wrappers to fortran functions.\n')
         lines = []
-        for l in string.split(string.join(funcwrappers2,'\n\n')+'\n','\n'):
+        for l in '\n\n'.join(funcwrappers2)+'\n'.split('\n'):
             if len(l)>72 and l[0]==' ':
                 lines.append(l[:72]+'&\n     &')
                 l = l[72:]
@@ -1225,7 +1228,7 @@
                     l = l[66:]
                 lines.append(l+'\n')
             else: lines.append(l+'\n')
-        lines = string.join(lines,'').replace('\n     &\n','\n')
+        lines = ''.join(lines).replace('\n     &\n','\n')
         f.write(lines)
         f.close()
         outmess('\tFortran 90 wrappers are saved to "%s"\n'%(wn))
@@ -1313,8 +1316,8 @@
                                         {'docsign':rd['docsign'],
                                          'docsignopt':optargs,
                                          })
-    rd['latexdocsignatureshort']=string.replace(rd['docsignatureshort'],'_','\\_')
-    rd['latexdocsignatureshort']=string.replace(rd['latexdocsignatureshort'],',',', ')
+    rd['latexdocsignatureshort']=rd['docsignatureshort'].replace('_','\\_')
+    rd['latexdocsignatureshort']=rd['latexdocsignatureshort'].replace(',',', ')
     cfs=stripcomma(replace('#callfortran##callfortranappend#',{'callfortran':rd['callfortran'],'callfortranappend':rd['callfortranappend']}))
     if len(rd['callfortranappend'])>1:
         rd['callcompaqfortran']=stripcomma(replace('#callfortran# 0,#callfortranappend#',{'callfortran':rd['callfortran'],'callfortranappend':rd['callfortranappend']}))

Modified: trunk/numpy/f2py/tests/mixed/run.py
===================================================================
--- trunk/numpy/f2py/tests/mixed/run.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/f2py/tests/mixed/run.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -8,7 +8,6 @@
 
 import os
 import sys
-import string
 import f2py2e
 from Numeric import array
 
@@ -19,7 +18,7 @@
         d,b=os.path.split(sys.argv[0])
         files = ['foo.f','foo_fixed.f90','foo_free.f90']
         files = [os.path.join(d,f) for f in files]
-        files = string.join(files)
+        files = ' '.join(files)
         args = ' -c -m mixed_f77_f90 %s %s'%(files,f2py_opts)
         c = '%s -c "import f2py2e;f2py2e.main()" %s' %(sys.executable,args)
         s = os.system(c)

Modified: trunk/numpy/f2py/use_rules.py
===================================================================
--- trunk/numpy/f2py/use_rules.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/f2py/use_rules.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -20,7 +20,10 @@
 f2py_version='See `f2py -v`'
 
 import pprint
-import sys,string,time,types,copy
+import sys
+import time
+import types
+import copy
 errmess=sys.stderr.write
 outmess=sys.stdout.write
 show=pprint.pprint
@@ -88,10 +91,10 @@
     ret={}
     vrd={'name':name,
          'realname':realname,
-         'REALNAME':string.upper(realname),
+         'REALNAME':realname.upper(),
          'usemodulename':usemodulename,
-         'USEMODULENAME':string.upper(usemodulename),
-         'texname':string.replace(name,'_','\\_'),
+         'USEMODULENAME':usemodulename.upper(),
+         'texname':name.replace('_','\\_'),
          'begintitle':gentitle('%s=>%s'%(name,realname)),
          'endtitle':gentitle('end of %s=>%s'%(name,realname)),
          'apiname':'#modulename#_use_%s_from_%s'%(realname,usemodulename)
@@ -99,7 +102,7 @@
     nummap={0:'Ro',1:'Ri',2:'Rii',3:'Riii',4:'Riv',5:'Rv',6:'Rvi',7:'Rvii',8:'Rviii',9:'Rix'}
     vrd['texnamename']=name
     for i in nummap.keys():
-        vrd['texnamename']=string.replace(vrd['texnamename'],`i`,nummap[i])
+        vrd['texnamename']=vrd['texnamename'].replace(`i`,nummap[i])
     if hasnote(vars[realname]): vrd['note']=vars[realname]['note']
     rd=dictappend({},vrd)
     var=vars[realname]

Modified: trunk/numpy/oldnumeric/matrix.py
===================================================================
--- trunk/numpy/oldnumeric/matrix.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/oldnumeric/matrix.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -2,7 +2,6 @@
 
 __all__ = ['UserArray', 'squeeze', 'Matrix', 'asarray', 'dot', 'k', 'Numeric', 'LinearAlgebra', 'identity', 'multiply', 'types', 'string']
 
-import string
 import types
 from user_array import UserArray, asarray
 import numpy.oldnumeric as Numeric
@@ -17,7 +16,7 @@
     _table[k] = chr(k)
 _table = ''.join(_table)
 
-_numchars = string.digits + ".-+jeEL"
+_numchars = '0123456789.-+jeEL'
 _todelete = []
 for k in _table:
     if k not in _numchars:

Modified: trunk/numpy/oldnumeric/precision.py
===================================================================
--- trunk/numpy/oldnumeric/precision.py	2007-10-29 11:09:37 UTC (rev 4329)
+++ trunk/numpy/oldnumeric/precision.py	2007-10-29 14:37:37 UTC (rev 4330)
@@ -7,8 +7,8 @@
            'PrecisionError', 'PyObject', 'Int', 'UInt',
            'UnsignedInteger', 'string', 'typecodes', 'zeros']
 
-import string
 from functions import zeros
+import string   # for backwards compatibility
 
 typecodes = {'Character':'c', 'Integer':'bhil', 'UnsignedInteger':'BHI', 'Float':'fd', 'Complex':'FD'}
 



More information about the Numpy-svn mailing list