diff options
author | Sebastian Berg <sebastianb@nvidia.com> | 2022-11-21 17:01:53 +0100 |
---|---|---|
committer | Sebastian Berg <sebastianb@nvidia.com> | 2022-11-21 17:01:53 +0100 |
commit | 7404cb68f20d8299a0935cb4242f37c41ab58aeb (patch) | |
tree | d38b11e8a528428808a9732f41508f0e02dc2dab /numpy | |
parent | 519ce63b8ef9e3af0688936b3b822a8cbcc123f7 (diff) | |
download | numpy-7404cb68f20d8299a0935cb4242f37c41ab58aeb.tar.gz |
DOC: Update np.void docs based on Matti's comments
Co-authored-by: Matti Picus <matti.picus@gmail.com>
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/_add_newdocs_scalars.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/numpy/core/_add_newdocs_scalars.py b/numpy/core/_add_newdocs_scalars.py index 24398d8b5..15d37522a 100644 --- a/numpy/core/_add_newdocs_scalars.py +++ b/numpy/core/_add_newdocs_scalars.py @@ -240,8 +240,8 @@ add_newdoc_for_scalar_type('void', [], be returned. dtype : dtype, optional If provided the dtype of the new scalar. This dtype must - be "void" dtype (i.e. a structured or unstructured - void). + be "void" dtype (i.e. a structured or unstructured void, + see also :ref:`defining-structured-types`). ..versionadded:: 1.24 @@ -251,12 +251,12 @@ add_newdoc_for_scalar_type('void', [], arbitrary byte data and structured dtypes, the void constructor has three calling conventions: - 1. ``np.void(5)`` creates a ``dtype="V5"`` scalar filled with + 1. ``np.void(5)`` creates a ``dtype="V5"`` scalar filled with five ``\0`` bytes. The 5 can be a Python or NumPy integer. - 2. ``np.void(b"bytes-like")`` creates a void scalar from - the byte string. The dtype is chosen based on its length. + 2. ``np.void(b"bytes-like")`` creates a void scalar from the byte string. + The dtype itemsize will match the byte string length, here ``"V10"``. 3. When a ``dtype=`` is passed the call is rougly the same as an - array creation. However a void scalar is returned when possible. + array creation. However, a void scalar rather than array is returned. Please see the examples which show all three different conventions. |