summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2020-01-06 15:41:03 +0200
committerGitHub <noreply@github.com>2020-01-06 15:41:03 +0200
commit90c2a551919474ae4f1669bb956f20316ec7580f (patch)
tree1909bd8b19648b7c53d9be510801685a7e01b206
parentc28fc48328e9621160debae4d0d99feeff3b8fdf (diff)
parent9132123e9d49e6fd68b164b82e01566041d5f5e9 (diff)
downloadnumpy-90c2a551919474ae4f1669bb956f20316ec7580f.tar.gz
Merge pull request #15253 from adeak/docbug_view_none
DOC: clarify the effect of None parameters passed to ndarray.view
-rw-r--r--numpy/core/_add_newdocs.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/numpy/core/_add_newdocs.py b/numpy/core/_add_newdocs.py
index 0dc46b6ad..f36c6941f 100644
--- a/numpy/core/_add_newdocs.py
+++ b/numpy/core/_add_newdocs.py
@@ -4069,21 +4069,26 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('var',
add_newdoc('numpy.core.multiarray', 'ndarray', ('view',
"""
- a.view(dtype=None, type=None)
+ a.view([dtype][, type])
New view of array with the same data.
+ .. note::
+ Passing None for ``dtype`` is different from omitting the parameter,
+ since the former invokes ``dtype(None)`` which is an alias for
+ ``dtype('float_')``.
+
Parameters
----------
dtype : data-type or ndarray sub-class, optional
- Data-type descriptor of the returned view, e.g., float32 or int16. The
- default, None, results in the view having the same data-type as `a`.
+ Data-type descriptor of the returned view, e.g., float32 or int16.
+ Omitting it results in the view having the same data-type as `a`.
This argument can also be specified as an ndarray sub-class, which
then specifies the type of the returned object (this is equivalent to
setting the ``type`` parameter).
type : Python type, optional
- Type of the returned view, e.g., ndarray or matrix. Again, the
- default None results in type preservation.
+ Type of the returned view, e.g., ndarray or matrix. Again, omission
+ of the parameter results in type preservation.
Notes
-----