[pypy-commit] pypy default: Changed numpy array's mean method to use the sum method

justinpeel noreply at buildbot.pypy.org
Tue Jul 12 00:47:13 CEST 2011


Author: Justin Peel <notmuchtotell at gmail.com>
Branch: 
Changeset: r45486:61077eb4052f
Date: 2011-07-11 09:26 -0600
http://bitbucket.org/pypy/pypy/changeset/61077eb4052f/

Log:	Changed numpy array's mean method to use the sum method

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
@@ -260,13 +260,7 @@
         return self.get_concrete().descr_setitem(space, item, value)
 
     def descr_mean(self, space):
-        s = 0
-        concrete = self.get_concrete()
-        size = concrete.find_size()
-        for i in xrange(size):
-            s += concrete.getitem(i)
-        return space.wrap(s / size)
-
+        return space.wrap(space.float_w(self.descr_sum(space))/self.find_size())
 
 class FloatWrapper(BaseArray):
     """


More information about the pypy-commit mailing list