[pypy-commit] pypy default: implement ravel() for numpy types

antocuni noreply at buildbot.pypy.org
Fri Mar 22 13:52:00 CET 2013


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r62658:260f7bccabb2
Date: 2013-03-22 13:51 +0100
http://bitbucket.org/pypy/pypy/changeset/260f7bccabb2/

Log:	implement ravel() for numpy types

diff --git a/pypy/module/micronumpy/interp_boxes.py b/pypy/module/micronumpy/interp_boxes.py
--- a/pypy/module/micronumpy/interp_boxes.py
+++ b/pypy/module/micronumpy/interp_boxes.py
@@ -180,6 +180,11 @@
         value = space.is_true(self)
         return space.wrap(W_BoolBox(value))
 
+    def descr_ravel(self, space):
+        from pypy.module.micronumpy.base import convert_to_array
+        w_values = space.newtuple([self])
+        return convert_to_array(space, w_values)
+
 class W_BoolBox(W_GenericBox, PrimitiveBox):
     descr__new__, _get_dtype = new_dtype_getter("bool")
 
@@ -427,6 +432,7 @@
     tolist = interp2app(W_GenericBox.item),
     any = interp2app(W_GenericBox.descr_any),
     all = interp2app(W_GenericBox.descr_all),
+    ravel = interp2app(W_GenericBox.descr_ravel),
 )
 
 W_BoolBox.typedef = TypeDef("bool_", W_GenericBox.typedef,


More information about the pypy-commit mailing list