summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2008-05-01 19:24:51 +0000
committerStefan van der Walt <stefan@sun.ac.za>2008-05-01 19:24:51 +0000
commit3056ee6f48e54b93e074ab62d8a6fca148b2508d (patch)
tree09ef68a3008b080bef90e9bd5d34a179fe6d2663 /numpy/add_newdocs.py
parentc402895302b40a13d200dab577d1b2bc108c4879 (diff)
downloadnumpy-3056ee6f48e54b93e074ab62d8a6fca148b2508d.tar.gz
Support for Python types in x.view.
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 17d21cd7c..3529938a5 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -2198,14 +2198,27 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('var',
add_newdoc('numpy.core.multiarray', 'ndarray', ('view',
- """a.view(dtype=None)
+ """a.view(dtype=None, type=None)
New view of array with the same data.
Parameters
----------
- dtype : sub-type or data-descriptor
- Data-type of the returned view.
+ dtype : data-type
+ Data-type descriptor of the returned view, e.g. float32 or int16.
+ type : python type
+ Type of the returned view, e.g. ndarray or matrix.
+
+ Examples
+ --------
+ >>> x = np.array([(1,2)],dtype=[('a',np.int8),('b',np.int8)])
+ >>> y = x.view(dtype=np.int16, type=np.matrix)
+
+ >>> print y.dtype
+ int16
+
+ >>> print type(y)
+ <class 'numpy.core.defmatrix.matrix'>
"""))