Collection Interface ABCs

collections.abc.Iterable

Objects recognized as providing __iter__. The older integer-index __getitem__ iteration protocol is not detected by this ABC; iter(obj) is the definitive practical test.

Formal Syntax & Structure

python syntaxpython
collections.abc.Iterable

Return Value

type

Abstract base class object representing the described interface; use it for recognition or inheritance.

Working Example

Example Snippetpython
import collections.abcprint(isinstance([1,2],collections.abc.Iterable))
Python Reference