[pypy-commit] pypy voidtype_strformat: extend dump_data

mattip noreply at buildbot.pypy.org
Thu Nov 21 23:51:57 CET 2013


Author: Matti Picus <matti.picus at gmail.com>
Branch: voidtype_strformat
Changeset: r68269:e16a81d977f5
Date: 2013-11-21 23:59 +0200
http://bitbucket.org/pypy/pypy/changeset/e16a81d977f5/

Log:	extend dump_data

diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -243,12 +243,13 @@
             return space.wrap(self.dump_data())
         return space.call_function(cache.w_array_str, self)
 
-    def dump_data(self):
+    def dump_data(self, prefix='array(', suffix=')'):
         i = self.create_iter()
         first = True
         dtype = self.get_dtype()
         s = StringBuilder()
-        s.append('array([')
+        s.append(prefix)
+        s.append('[')
         while not i.done():
             if first:
                 first = False
@@ -256,7 +257,8 @@
                 s.append(', ')
             s.append(dtype.itemtype.str_format(i.getitem()))
             i.next()
-        s.append('])')
+        s.append(']')
+        s.append(suffix)
         return s.build()
 
     def create_iter(self, shape=None, backward_broadcast=False, require_index=False):


More information about the pypy-commit mailing list