Collection Interface ABCs

collections.abc.Mapping

Key-value interface with __getitem__, __iter__ and __len__. Direct subclasses receive read-only mapping mixins; implementations may still be mutable.

Formal Syntax & Structure

python syntaxpython
collections.abc.Mapping

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({"x":1},collections.abc.Mapping))
Python Reference