summaryrefslogtreecommitdiff
path: root/numpy/core/fromnumeric.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-04-06 16:32:39 -0600
committerGitHub <noreply@github.com>2018-04-06 16:32:39 -0600
commit70c060dfdab9e0c31eeec248ed40c26d3555033c (patch)
tree6fb60daf9c51a908c2dc1f92ec9358420f217f3e /numpy/core/fromnumeric.py
parent1f9c30ef0f4f7a0c3e0227c3de681a11fcc24861 (diff)
parent6d950b383bff4ac2448b3f6a1e7573e7ea176051 (diff)
downloadnumpy-70c060dfdab9e0c31eeec248ed40c26d3555033c.tar.gz
Merge pull request #10670 from eric-wieser/deprecate-sum-generator
DEP: Deprecate np.sum(generator)
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r--numpy/core/fromnumeric.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
index 5f1aadbf5..948c2139d 100644
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -1900,6 +1900,12 @@ def sum(a, axis=None, dtype=None, out=None, keepdims=np._NoValue):
"""
if isinstance(a, _gentype):
+ # 2018-02-25, 1.15.0
+ warnings.warn(
+ "Calling np.sum(generator) is deprecated, and in the future will give a different result. "
+ "Use np.sum(np.from_iter(generator)) or the python sum builtin instead.",
+ DeprecationWarning, stacklevel=2)
+
res = _sum_(a)
if out is not None:
out[...] = res