summaryrefslogtreecommitdiff
path: root/doc/source
diff options
context:
space:
mode:
authorAllan Haldane <allan.haldane@gmail.com>2015-06-05 12:10:25 -0400
committerAllan Haldane <allan.haldane@gmail.com>2015-06-19 16:43:31 -0400
commita93b86217e9ff8cc1060aaf362cd682b518cfb7b (patch)
treef189ae6dadc7bd6d38fff815aaf65726c22f605d /doc/source
parent4027d16f0aa19e551067bf0c93dbe057e0142bb8 (diff)
downloadnumpy-a93b86217e9ff8cc1060aaf362cd682b518cfb7b.tar.gz
BUG: automatically convert recarray dtype to np.record
Viewing an ndarray as a np.recarray now automatically converts the dtype to np.record. This commit also fixes assignment to MaskedArray's dtype attribute, fixes the repr of recarrays with non-structured dtype, and removes recarray.view so that viewing a recarray as a non-structured dtype no longer converts to ndarray type. Fixes #3581
Diffstat (limited to 'doc/source')
-rw-r--r--doc/source/reference/arrays.dtypes.rst18
1 files changed, 10 insertions, 8 deletions
diff --git a/doc/source/reference/arrays.dtypes.rst b/doc/source/reference/arrays.dtypes.rst
index 28e2d4f82..8f14118d6 100644
--- a/doc/source/reference/arrays.dtypes.rst
+++ b/doc/source/reference/arrays.dtypes.rst
@@ -424,16 +424,18 @@ Type strings
``(base_dtype, new_dtype)``
- This usage is discouraged. In NumPy 1.7 and later, it is possible
- to specify struct dtypes with overlapping fields, functioning like
- the 'union' type in C. The union mechanism is preferred.
-
- Both arguments must be convertible to data-type objects in this
- case. The *base_dtype* is the data-type object that the new
- data-type builds on. This is how you could assign named fields to
- any built-in data-type object, as done in
+ In NumPy 1.7 and later, this form allows `base_dtype` to be interpreted as
+ a structured dtype. Arrays created with this dtype will have underlying
+ dtype `base_dtype` but will have fields and flags taken from `new_dtype`.
+ This is useful for creating custom structured dtypes, as done in
:ref:`record arrays <arrays.classes.rec>`.
+ This form also makes it possible to specify struct dtypes with overlapping
+ fields, functioning like the 'union' type in C. This usage is discouraged,
+ however, and the union mechanism is preferred.
+
+ Both arguments must be convertible to data-type objects with the same total
+ size.
.. admonition:: Example
32-bit integer, whose first two bytes are interpreted as an integer