Author: David Lievens <david.liev...@gmail.com>
Branch: py3.3
Changeset: r73948:81081f10e7e0
Date: 2014-10-14 11:39 +0100
http://bitbucket.org/pypy/pypy/changeset/81081f10e7e0/

Log:    Incorporate review feedback of Armin Rigo

diff --git a/pypy/module/itertools/interp_itertools.py 
b/pypy/module/itertools/interp_itertools.py
--- a/pypy/module/itertools/interp_itertools.py
+++ b/pypy/module/itertools/interp_itertools.py
@@ -1199,10 +1199,6 @@
     def __init__(self, space, w_iterable, w_func=None):
         self.space = space
         self.w_iterable = w_iterable
-        if w_func is None:  # default operator is add
-            _import = space.getattr(space.builtin, space.wrap("__import__"))
-            _op = space.call_function(_import, space.wrap("operator"))
-            w_func = space.getattr(_op, space.wrap("add")) 
         self.w_func = w_func
         self.w_total = None
 
@@ -1215,7 +1211,10 @@
             self.w_total = w_value
             return w_value
 
-        self.w_total = self.space.call_function(self.w_func, self.w_total, 
w_value)
+        if self.w_func is None:
+            self.w_total = self.space.add(self.w_total, w_value)
+        else:
+            self.w_total = self.space.call_function(self.w_func, self.w_total, 
w_value)
         return self.w_total
 
 def W_Accumulate__new__(space, w_subtype, w_iterable, w_func=None):
@@ -1231,3 +1230,4 @@
 "accumulate(iterable) --> accumulate object
 
 Return series of accumulated sums.""")
+
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to