bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / iterable
function
numpy:iterable
source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/lib/_function_base_impl.py :363
Signature
def iterable ( y ) Summary
Check whether or not an object can be iterated over.
Parameters
y: objectInput object.
Returns
b: boolReturn
Trueif the object has an iterator method or is a sequence andFalseotherwise.
Notes
In most cases, the results of np.iterable(obj) are consistent with isinstance(obj, collections.abc.Iterable). One notable exception is the treatment of 0-dimensional arrays
>>> from collections.abc import Iterable >>> a = np.array(1.0) # 0-dimensional numpy array >>> isinstance(a, Iterable) True >>> np.iterable(a) False
Examples
import numpy as np np.iterable([1, 2, 3]) np.iterable(2)✓
Aliases
-
numpy.iterable