__complex__¶
- array.__complex__() complex ¶
Converts a zero-dimensional array to a Python
complex
object.- Parameters:
self (array) – zero-dimensional array instance.
- Returns:
out (complex) – a Python
complex
object representing the single element of the array instance.
Notes
Special cases
For boolean operands,
If
self
isTrue
, the result is1+0j
.If
self
isFalse
, the result is0+0j
.
For real-valued floating-point operands,
If
self
isNaN
, the result isNaN + NaN j
.If
self
is+infinity
, the result is+infinity + 0j
.If
self
is-infinity
, the result is-infinity + 0j
.If
self
is a finite number, the result isself + 0j
.
Lazy implementations
The Python language requires the return value to be of type
complex
. Lazy implementations are therefore not able to return any kind of lazy/delayed object here and should raise aValueError
instead.New in version 2022.12.
Changed in version 2023.12: Allowed lazy implementations to error.