[Numpy-svn] r3215 - in trunk/numpy: core lib/tests

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Sep 25 11:27:20 CDT 2006


Author: oliphant
Date: 2006-09-25 11:26:43 -0500 (Mon, 25 Sep 2006)
New Revision: 3215

Modified:
   trunk/numpy/core/numeric.py
   trunk/numpy/lib/tests/test_ufunclike.py
Log:
Fix back repr of arrays to not have quote unless flexible.

Modified: trunk/numpy/core/numeric.py
===================================================================
--- trunk/numpy/core/numeric.py	2006-09-24 07:08:26 UTC (rev 3214)
+++ trunk/numpy/core/numeric.py	2006-09-25 16:26:43 UTC (rev 3215)
@@ -425,9 +425,9 @@
         typename=arr.dtype.name
         lf = ''
         if issubclass(arr.dtype.type, flexible):
-            typename = str(arr.dtype)
+            typename = "'%s'" % str(arr.dtype)
             lf = '\n'+' '*len("array(")
-        return cName + "(%s, %sdtype='%s')" % (lst, lf, typename)
+        return cName + "(%s, %sdtype=%s)" % (lst, lf, typename)
 
 def array_str(a, max_line_width=None, precision=None, suppress_small=None):
     return array2string(a, max_line_width, precision, suppress_small, ' ', "", str)

Modified: trunk/numpy/lib/tests/test_ufunclike.py
===================================================================
--- trunk/numpy/lib/tests/test_ufunclike.py	2006-09-24 07:08:26 UTC (rev 3214)
+++ trunk/numpy/lib/tests/test_ufunclike.py	2006-09-25 16:26:43 UTC (rev 3215)
@@ -18,26 +18,26 @@
 Test isposinf, isneginf, sign
 >>> a = nx.array([nx.Inf, -nx.Inf, nx.NaN, 0.0, 3.0, -3.0])
 >>> U.isposinf(a)
-array([True, False, False, False, False, False], dtype='bool')
+array([True, False, False, False, False, False], dtype=bool)
 >>> U.isneginf(a)
-array([False, True, False, False, False, False], dtype='bool')
+array([False, True, False, False, False, False], dtype=bool)
 >>> nx.sign(a)
 array([ 1., -1.,  0.,  0.,  1., -1.])
 
 Same thing with an output array:
 >>> y = nx.zeros(a.shape, bool)
 >>> U.isposinf(a, y)
-array([True, False, False, False, False, False], dtype='bool')
+array([True, False, False, False, False, False], dtype=bool)
 >>> y
-array([True, False, False, False, False, False], dtype='bool')
+array([True, False, False, False, False, False], dtype=bool)
 >>> U.isneginf(a, y)
-array([False, True, False, False, False, False], dtype='bool')
+array([False, True, False, False, False, False], dtype=bool)
 >>> y
-array([False, True, False, False, False, False], dtype='bool')
+array([False, True, False, False, False, False], dtype=bool)
 >>> nx.sign(a, y)
-array([True, True, False, False, True, True], dtype='bool')
+array([True, True, False, False, True, True], dtype=bool)
 >>> y
-array([True, True, False, False, True, True], dtype='bool')
+array([True, True, False, False, True, True], dtype=bool)
 
 Now log2:
 >>> a = nx.array([4.5, 2.3, 6.5])



More information about the Numpy-svn mailing list