bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / void
class
numpy:void
source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/__init__.py
Summary
Create a new structured or unstructured void scalar.
Parameters
length_or_data: int, array-like, bytes-like, objectOne of multiple meanings (see notes). The length or bytes data of an unstructured void. Or alternatively, the data to be stored in the new scalar when dtype is provided. This can be an array-like, in which case an array may be returned.
dtype: dtype, optionalIf provided the dtype of the new scalar. This dtype must be "void" dtype (i.e. a structured or unstructured void, see also
defining-structured-types).
Notes
For historical reasons and because void scalars can represent both arbitrary byte data and structured dtypes, the void constructor has three calling conventions:
np.void(5)creates adtype="V5"scalar filled with five\0bytes. The 5 can be a Python or NumPy integer.
np.void(b"bytes-like")creates a void scalar from the byte string.The dtype itemsize will match the byte string length, here
"V10".
When a
dtype=is passed the call is roughly the same as anarray creation. However, a void scalar rather than array is returned.
Please see the examples which show all three different conventions.
Examples
np.void(5) np.void(b'abcd') np.void((3.2, b'eggs'), dtype="d,S5") np.void(3, dtype=[('x', np.int8), ('y', np.int8)])✓
Aliases
-
numpy.void