__bool__¶
- array.__bool__() bool ¶
Converts a zero-dimensional array to a Python
bool
object.- Parameters:
self (array) – zero-dimensional array instance.
- Returns:
out (bool) – a Python
bool
object representing the single element of the array.
Notes
Special cases
For real-valued floating-point operands,
If
self
isNaN
, the result isTrue
.If
self
is either+infinity
or-infinity
, the result isTrue
.If
self
is either+0
or-0
, the result isFalse
.
For complex floating-point operands, special cases must be handled as if the operation is implemented as the logical OR of
bool(real(self))
andbool(imag(self))
.Changed in version 2022.12: Added boolean and complex data type support.