[pypy-commit] pypy numpy-refactor: some more boilerplate
fijal
noreply at buildbot.pypy.org
Thu Aug 30 20:41:36 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: numpy-refactor
Changeset: r57034:f36d1b640bef
Date: 2012-08-30 20:41 +0200
http://bitbucket.org/pypy/pypy/changeset/f36d1b640bef/
Log: some more boilerplate
diff --git a/pypy/module/micronumpy/interp_arrayops.py b/pypy/module/micronumpy/interp_arrayops.py
--- a/pypy/module/micronumpy/interp_arrayops.py
+++ b/pypy/module/micronumpy/interp_arrayops.py
@@ -1,28 +1,6 @@
-from pypy.module.micronumpy.interp_numarray import convert_to_array,\
- VirtualArray
-from pypy.module.micronumpy import signature
-
-class WhereArray(VirtualArray):
- def __init__(self, space, arr, x, y):
- self.arr = arr
- self.x = x
- self.y = y
- VirtualArray.__init__(self, 'where', arr.shape[:],
- x.find_dtype())
-
- def create_sig(self):
- if self.forced_result is not None:
- return self.forced_result.create_sig()
- return signature.WhereSignature(self.res_dtype, self.arr.find_dtype(),
- self.arr.create_sig(),
- self.x.create_sig(),
- self.y.create_sig())
-
- def _del_sources(self):
- self.arr = None
- self.x = None
- self.y = None
+from pypy.module.micronumpy.support import convert_to_array
+from pypy.module.micronumpy import loop
def where(space, w_arr, w_x, w_y):
"""where(condition, [x, y])
@@ -87,4 +65,4 @@
arr = convert_to_array(space, w_arr)
x = convert_to_array(space, w_x)
y = convert_to_array(space, w_y)
- return WhereArray(space, arr, x, y)
+ return loop.where(space, arr, x, y)
diff --git a/pypy/module/micronumpy/interp_flatiter.py b/pypy/module/micronumpy/interp_flatiter.py
--- a/pypy/module/micronumpy/interp_flatiter.py
+++ b/pypy/module/micronumpy/interp_flatiter.py
@@ -1,5 +1,10 @@
from pypy.interpreter.baseobjspace import Wrappable
+from pypy.interpreter.typedef import TypeDef
class W_FlatIterator(Wrappable):
pass
+
+W_FlatIterator.typedef = TypeDef(
+ 'flatiter',
+)
More information about the pypy-commit
mailing list