summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Rauber <jonasrauber@users.noreply.github.com>2018-03-15 13:13:07 (GMT)
committerGitHub <noreply@github.com>2018-03-15 13:13:07 (GMT)
commit4bbf48255a3cbd8a4c707867818d0277437bf202 (patch)
treea4a8dd3c0a17fe790087c5e49b8eebd2fc025eba
parent37327f3cb970eeedce33bdbd6efc0d35ee0856b6 (diff)
downloadpython-numpy-4bbf48255a3cbd8a4c707867818d0277437bf202.zip
python-numpy-4bbf48255a3cbd8a4c707867818d0277437bf202.tar.gz
python-numpy-4bbf48255a3cbd8a4c707867818d0277437bf202.tar.bz2
Update add_newdocs.py
-rw-r--r--numpy/add_newdocs.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 535b372..6d0cfb5 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -3061,9 +3061,7 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('size',
Number of elements in the array.
Equal to ``np.prod(a.shape)``, i.e., the product of the array's
- dimensions, except that ``size`` returns an instance of ``int``
- whereas ``np.prod(a.shape)`` returns an instance of ``np.int_``
- (e.g. ``np.int64``).
+ dimensions.
Examples
--------
@@ -3072,6 +3070,14 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('size',
30
>>> np.prod(x.shape)
30
+
+ Notes
+ -----
+ `a.size` returns a standard arbitrary precision Python integer. This
+ may not be the case with other methods of obtaining the same value
+ (like the suggested ``np.prod(a.shape)``, which returns an instance
+ of ``np.int_``), and may be relevant if the value is used further in
+ calculations that may overflow a fixed size integer type.
"""))