summaryrefslogtreecommitdiff
path: root/numpy/core/shape_base.py
diff options
context:
space:
mode:
authorSeth Troisi <sethtroisi@google.com>2020-01-23 16:49:01 -0800
committerSeth Troisi <sethtroisi@google.com>2020-01-23 16:52:25 -0800
commit823f6819dd86e75f772a3a725996773dd6b688e2 (patch)
tree85b754adb9f658fea27e9b7c4eeb383c16b1a1fd /numpy/core/shape_base.py
parent68224f43d09393c1981bb83ee3c13a5158d2817c (diff)
downloadnumpy-823f6819dd86e75f772a3a725996773dd6b688e2.tar.gz
MAINT: Remove Python2 workarounds
Diffstat (limited to 'numpy/core/shape_base.py')
-rw-r--r--numpy/core/shape_base.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/numpy/core/shape_base.py b/numpy/core/shape_base.py
index d2f26149b..e909cec6f 100644
--- a/numpy/core/shape_base.py
+++ b/numpy/core/shape_base.py
@@ -2,6 +2,7 @@ __all__ = ['atleast_1d', 'atleast_2d', 'atleast_3d', 'block', 'hstack',
'stack', 'vstack']
import functools
+import itertools
import operator
import warnings
@@ -530,14 +531,7 @@ def _atleast_nd(a, ndim):
def _accumulate(values):
- # Helper function because Python 2.7 doesn't have
- # itertools.accumulate
- value = 0
- accumulated = []
- for v in values:
- value += v
- accumulated.append(value)
- return accumulated
+ return list(itertools.accumulate(values))
def _concatenate_shapes(shapes, axis):