Collection Interface ABCs

collections.abc.Buffer

Interface for buffer exporters introduced in Python 3.12, associated with __buffer__. Actual view creation can still fail for unsupported flags or exporter state.

Formal Syntax & Structure

python syntaxpython
collections.abc.Buffer

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(bytearray(b"AB"),collections.abc.Buffer))
Python Reference