__index__¶
- array.__index__() int ¶
Converts a zero-dimensional integer array to a Python
int
object.Note
This method is called to implement operator.index(). See also PEP 357.
- Parameters:
self (array) – zero-dimensional array instance. Should have an integer data type. If
self
has a floating-point data type, the function must raise aTypeError
.- Returns:
out (int) – a Python
int
object representing the single element of the array instance.
Notes
Lazy implementations
The Python language requires the return value to be of type
int
. Lazy implementations are therefore not able to return any kind of lazy/delayed object here and should raise aValueError
instead.Changed in version 2023.12: Allowed lazy implementations to error.