2 ms·
This is incorrect, because you can generally do this for sequence types: isinstance(items, Sequence) Or perhaps: isinstance(items, Iterable) # works
by saila 5y ago
This is incorrect, because you can generally do this for sequence types:
isinstance(items, Sequence)
Or perhaps:
isinstance(items, Iterable) # works with numpy arrays
Or, equivalent to using len() for type checking, you could do:
isinstance(items, Sized)