summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2018-10-09 13:57:08 +0300
committermattip <matti.picus@gmail.com>2018-10-10 13:02:44 +0300
commit1c2abd36473d9c178557f4cc2ce50094c9b4636b (patch)
tree2a52c2eca57ec28b2b44138058941a1db2b7cae8 /numpy
parent86a7acc8582923604fac849bb19f0b08efc0a91a (diff)
downloadnumpy-1c2abd36473d9c178557f4cc2ce50094c9b4636b.tar.gz
DEP: deprecate asscalar
Diffstat (limited to 'numpy')
-rw-r--r--numpy/lib/type_check.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py
index 3f7aa32fa..8c79da7eb 100644
--- a/numpy/lib/type_check.py
+++ b/numpy/lib/type_check.py
@@ -2,6 +2,7 @@
"""
from __future__ import division, absolute_import, print_function
+import warnings
__all__ = ['iscomplexobj', 'isrealobj', 'imag', 'iscomplex',
'isreal', 'nan_to_num', 'real', 'real_if_close',
@@ -469,6 +470,10 @@ def asscalar(a):
"""
Convert an array of size 1 to its scalar equivalent.
+ .. deprecated:: 1.16
+
+ Deprecated, use `numpy.ndarray.item()` instead.
+
Parameters
----------
a : ndarray
@@ -486,6 +491,10 @@ def asscalar(a):
24
"""
+
+ # 2018-10-10, 1.16
+ warnings.warn('np.asscalar(a) will be removed in v1.18 of numpy, use '
+ 'a.item() instead', DeprecationWarning, stacklevel=1)
return a.item()
#-----------------------------------------------------------------------------