[Numpy-svn] r4324 - in trunk/numpy: distutils f2py linalg/lapack_lite

numpy-svn@scip... numpy-svn@scip...
Mon Oct 29 04:10:16 CDT 2007


Author: jarrod.millman
Date: 2007-10-29 04:09:59 -0500 (Mon, 29 Oct 2007)
New Revision: 4324

Modified:
   trunk/numpy/distutils/ccompiler.py
   trunk/numpy/distutils/core.py
   trunk/numpy/f2py/crackfortran.py
   trunk/numpy/f2py/f2py2e.py
   trunk/numpy/linalg/lapack_lite/make_lite.py
Log:
Using the in operator to find substrings.  It is shorter and easier to understand.


Modified: trunk/numpy/distutils/ccompiler.py
===================================================================
--- trunk/numpy/distutils/ccompiler.py	2007-10-29 08:33:07 UTC (rev 4323)
+++ trunk/numpy/distutils/ccompiler.py	2007-10-29 09:09:59 UTC (rev 4324)
@@ -207,7 +207,7 @@
         except (AttributeError, ValueError):
             pass
 
-        if hasattr(self,'compiler') and self.compiler[0].find('cc')>=0:
+        if hasattr(self,'compiler') and 'cc' in self.compiler[0]:
             if not self.compiler_cxx:
                 if self.compiler[0].startswith('gcc'):
                     a, b = 'gcc', 'g++'

Modified: trunk/numpy/distutils/core.py
===================================================================
--- trunk/numpy/distutils/core.py	2007-10-29 08:33:07 UTC (rev 4323)
+++ trunk/numpy/distutils/core.py	2007-10-29 09:09:59 UTC (rev 4324)
@@ -92,7 +92,7 @@
     # We can't use isinstance, as the DistributionWithoutHelpCommands
     # class is local to a function in setuptools.command.easy_install
     if dist is not None and \
-            repr(dist).find('DistributionWithoutHelpCommands') != -1:
+            'DistributionWithoutHelpCommands' in repr(dist):
         dist = None
     if always and dist is None:
         dist = distutils.dist.Distribution()

Modified: trunk/numpy/f2py/crackfortran.py
===================================================================
--- trunk/numpy/f2py/crackfortran.py	2007-10-29 08:33:07 UTC (rev 4323)
+++ trunk/numpy/f2py/crackfortran.py	2007-10-29 09:09:59 UTC (rev 4324)
@@ -1494,7 +1494,7 @@
         for g in block:
             setmesstext(g)
             g=postcrack(g,tab=tab+'\t')
-            if g.has_key('name') and string.find(g['name'],'__user__')>=0: # sort user routines to appear first
+            if g.has_key('name') and '__user__' in g['name']: # sort user routines to appear first
                 uret.append(g)
             else:
                 gret.append(g)
@@ -1518,7 +1518,7 @@
     if block.has_key('use'):
         useblock=block['use']
         for k in useblock.keys():
-            if string.find(k,'__user__')>=0:
+            if '__user__' in k:
                 userisdefined.append(k)
 ##                 if useblock[k].has_key('map'):
 ##                     for n in useblock[k]['map'].values():

Modified: trunk/numpy/f2py/f2py2e.py
===================================================================
--- trunk/numpy/f2py/f2py2e.py	2007-10-29 08:33:07 UTC (rev 4323)
+++ trunk/numpy/f2py/f2py2e.py	2007-10-29 09:09:59 UTC (rev 4324)
@@ -289,7 +289,7 @@
     outmess('Building modules...\n')
     modules,mnames,isusedby=[],[],{}
     for i in range(len(list)):
-        if string.find(list[i]['name'],'__user__')>=0:
+        if '__user__' in list[i]['name']:
             cb_rules.buildcallbacks(list[i])
         else:
             if list[i].has_key('use'):

Modified: trunk/numpy/linalg/lapack_lite/make_lite.py
===================================================================
--- trunk/numpy/linalg/lapack_lite/make_lite.py	2007-10-29 08:33:07 UTC (rev 4323)
+++ trunk/numpy/linalg/lapack_lite/make_lite.py	2007-10-29 09:09:59 UTC (rev 4324)
@@ -141,7 +141,7 @@
 class LapackLibrary(FortranLibrary):
     def _newFortranRoutine(self, rname, filename):
         routine = FortranLibrary._newFortranRoutine(self, rname, filename)
-        if filename.find('BLAS') != -1:
+        if 'BLAS' in filename
             routine.type = 'blas'
         elif rname.startswith('z'):
             routine.type = 'zlapack'



More information about the Numpy-svn mailing list