diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-02-26 21:31:14 -0800 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-02-26 21:35:44 -0800 |
commit | 6d950b383bff4ac2448b3f6a1e7573e7ea176051 (patch) | |
tree | 4681d3a78072848bf5c5dee343a9a2f99c1dfa9e /numpy/core/fromnumeric.py | |
parent | 6462068ee40344ebe9a60b3ddcad0e9590d5a260 (diff) | |
download | numpy-6d950b383bff4ac2448b3f6a1e7573e7ea176051.tar.gz |
DEP: Deprecate np.sum(generator)
Fixes #10652
Introduced in a13aad3ac33b629f3e696b4d4d5dbf4b5605d567
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r-- | numpy/core/fromnumeric.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index de85c1143..6c7ef4c1f 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -1881,6 +1881,12 @@ def sum(a, axis=None, dtype=None, out=None, keepdims=np._NoValue): if keepdims is not np._NoValue: kwargs['keepdims'] = keepdims 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 |