bundles / numpy latest / numpy / isrealobj
_ArrayFunctionDispatcher
numpy:isrealobj
source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/lib/_type_check_impl.py :312
Signature
def isrealobj ( x ) Summary
Return True if x is a not complex type or an array of complex numbers.
Extended Summary
The type of the input is checked, not the value. So even if the input has an imaginary part equal to zero, isrealobj evaluates to False if the data type is complex.
Parameters
x: anyThe input can be of any type and shape.
Returns
y: boolThe return value, False if
xis of a complex type.
Notes
The function is only meant for arrays with numerical values but it accepts all other objects. Since it assumes array input, the return value of other objects may be True.
>>> np.isrealobj('A string') True >>> np.isrealobj(False) True >>> np.isrealobj(None) True
Examples
import numpy as np np.isrealobj(1) np.isrealobj(1+0j) np.isrealobj([3, 1+0j, True])✓
See also
- iscomplexobj
- isreal
Aliases
-
numpy.isrealobj