[Scipy-svn] r3518 - in trunk/scipy: sandbox/constants sandbox/xplt weave

scipy-svn@scip... scipy-svn@scip...
Mon Nov 12 22:50:04 CST 2007


Author: jarrod.millman
Date: 2007-11-12 22:50:00 -0600 (Mon, 12 Nov 2007)
New Revision: 3518

Modified:
   trunk/scipy/sandbox/constants/codata.py
   trunk/scipy/sandbox/xplt/Mplot.py
   trunk/scipy/weave/build_tools.py
   trunk/scipy/weave/cpp_namespace_spec.py
   trunk/scipy/weave/platform_info.py
Log:
use the in operator for substring testing


Modified: trunk/scipy/sandbox/constants/codata.py
===================================================================
--- trunk/scipy/sandbox/constants/codata.py	2007-11-13 04:36:30 UTC (rev 3517)
+++ trunk/scipy/sandbox/constants/codata.py	2007-11-13 04:50:00 UTC (rev 3518)
@@ -376,7 +376,7 @@
     result = []
     for key in physical_constants :
         l_key = string.lower(key)
-        if string.find(l_key,l_sub) >= 0 :
+        if l_sub in l_key:
             result.append(key)
     result.sort()
     for key in result :

Modified: trunk/scipy/sandbox/xplt/Mplot.py
===================================================================
--- trunk/scipy/sandbox/xplt/Mplot.py	2007-11-13 04:36:30 UTC (rev 3517)
+++ trunk/scipy/sandbox/xplt/Mplot.py	2007-11-13 04:50:00 UTC (rev 3518)
@@ -177,7 +177,7 @@
     import string
     value = default
     for k in dict.keys():
-        if string.find(str,k) >= 0:
+        if k in str:
             value = dict[k]
             break
     return value

Modified: trunk/scipy/weave/build_tools.py
===================================================================
--- trunk/scipy/weave/build_tools.py	2007-11-13 04:36:30 UTC (rev 3517)
+++ trunk/scipy/weave/build_tools.py	2007-11-13 04:50:00 UTC (rev 3518)
@@ -115,7 +115,7 @@
     # http://mail.python.org/pipermail/python-dev/2001-March/013510.html
     platform = sys.platform
     version = sys.version.lower()
-    if platform[:5] == 'sunos' and version.find('gcc') != -1:
+    if platform[:5] == 'sunos' and 'gcc' in version:
         extra_link_args = kw.get('extra_link_args',[])
         kw['extra_link_args'] = ['-mimpure-text'] +  extra_link_args
 
@@ -345,7 +345,7 @@
         w.close()
         str_result = r.read()
         #print str_result
-        if string.find(str_result,'Reading specs') != -1:
+        if 'Reading specs' in str_result:
             result = 1
     except:
         # This was needed because the msvc compiler messes with
@@ -364,7 +364,7 @@
         w.close()
         str_result = r.read()
         #print str_result
-        if string.find(str_result,'Microsoft') != -1:
+        if 'Microsoft' in str_result:
             result = 1
     except:
         #assume we're ok if devstudio exists

Modified: trunk/scipy/weave/cpp_namespace_spec.py
===================================================================
--- trunk/scipy/weave/cpp_namespace_spec.py	2007-11-13 04:36:30 UTC (rev 3517)
+++ trunk/scipy/weave/cpp_namespace_spec.py	2007-11-13 04:50:00 UTC (rev 3518)
@@ -76,7 +76,7 @@
     def type_match(self,value):
         try:
             cpp_ident = value.split('_')[2]
-            if cpp_ident.find(self.namespace) != -1:
+            if self.namespace in cpp.ident:
                 return 1
         except:
             pass

Modified: trunk/scipy/weave/platform_info.py
===================================================================
--- trunk/scipy/weave/platform_info.py	2007-11-13 04:36:30 UTC (rev 3517)
+++ trunk/scipy/weave/platform_info.py	2007-11-13 04:50:00 UTC (rev 3518)
@@ -172,7 +172,7 @@
         w,r=os.popen4(cmd)
         w.close()
         str_result = r.read()
-        if str_result.find('Reading specs') != -1:
+        if 'Reading specs' in str_result:
             result = 1
     except:
         # This was needed because the msvc compiler messes with
@@ -190,7 +190,7 @@
         w,r=os.popen4('cl')
         w.close()
         str_result = r.read()
-        if str_result.find('Microsoft') != -1:
+        if 'Microsoft' in str_result:
             result = 1
     except:
         #assume we're ok if devstudio exists



More information about the Scipy-svn mailing list