You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
is_nonstr_iter recognize 0-D numpy array as iterable #4001
So, a 0-D numpy array is iterable (has the __iter__ method) but is not an iterator (doens't have the __next__ method).
In [8]: isinstance(x, Iterator)
Out[8]: False
Because we usually need to loop over an iterable or join an iterable, perhaps we should use isinstance(x, Iterator) rather than isinstance(x, Iterable)?
Edit: isinstance([2, 3, 4], Iterator) returns False, so it doens't work.
Activity