Collection Interface ABCs

collections.abc.Container

Objects implementing __contains__. Membership can also fall back to iteration even if this ABC test fails.

Formal Syntax & Structure

python syntaxpython
collections.abc.Container

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.Container))
Python Reference