diff options
author | Bas van Beek <b.f.van.beek@vu.nl> | 2021-09-24 17:20:52 +0200 |
---|---|---|
committer | Bas van Beek <b.f.van.beek@vu.nl> | 2021-09-24 17:48:42 +0200 |
commit | 7e6021ebcd3529e8c952b675090ec40f2f17db84 (patch) | |
tree | 07dc4fbaa5c7543203c422170ae7856f05f3bbc5 | |
parent | 37fcc1ce08c3eee86feaeef61e385d463a07ae35 (diff) | |
download | numpy-7e6021ebcd3529e8c952b675090ec40f2f17db84.tar.gz |
DOC: Add a note about record array dtypes
-rw-r--r-- | numpy/typing/__init__.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/numpy/typing/__init__.py b/numpy/typing/__init__.py index 81ab1afad..1e366eb34 100644 --- a/numpy/typing/__init__.py +++ b/numpy/typing/__init__.py @@ -131,6 +131,22 @@ If it is known in advance that an operation _will_ perform a 0D-array -> scalar cast, then one can consider manually remedying the situation with either `typing.cast` or a ``# type: ignore`` comment. +Record array dtypes +~~~~~~~~~~~~~~~~~~~ + +The dtype of `numpy.recarray`, and the `numpy.rec` functions in general, +can be specified in one of two ways: + +* Directly via the ``dtype`` argument. +* With up to five helper arguments that operate via `numpy.format_parser`: + ``formats``, ``names``, ``titles``, ``aligned`` and ``byteorder``. + +These two approaches are currently typed as being mutually exclusive, +*i.e.* if ``dtype`` is specified than one may not specify ``formats``. +While this mutual exclusivity is not (strictly) enforced during runtime, +combining both dtype specifiers can lead to unexpected or even downright +buggy behavior. + API --- |