Skip to content

Commit 7e6021e

Browse files
author
Bas van Beek
committed
DOC: Add a note about record array dtypes
1 parent 37fcc1c commit 7e6021e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

numpy/typing/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,22 @@
131131
0D-array -> scalar cast, then one can consider manually remedying the
132132
situation with either `typing.cast` or a ``# type: ignore`` comment.
133133
134+
Record array dtypes
135+
~~~~~~~~~~~~~~~~~~~
136+
137+
The dtype of `numpy.recarray`, and the `numpy.rec` functions in general,
138+
can be specified in one of two ways:
139+
140+
* Directly via the ``dtype`` argument.
141+
* With up to five helper arguments that operate via `numpy.format_parser`:
142+
``formats``, ``names``, ``titles``, ``aligned`` and ``byteorder``.
143+
144+
These two approaches are currently typed as being mutually exclusive,
145+
*i.e.* if ``dtype`` is specified than one may not specify ``formats``.
146+
While this mutual exclusivity is not (strictly) enforced during runtime,
147+
combining both dtype specifiers can lead to unexpected or even downright
148+
buggy behavior.
149+
134150
API
135151
---
136152

0 commit comments

Comments
 (0)