Collection Interface ABCs

collections.abc.ByteString

Legacy byte sequence ABC for bytes and bytearray. Deprecated since 3.12; it does not describe the full buffer protocol and should not be used in new code.

Formal Syntax & Structure

python syntaxpython
collections.abc.ByteString

Return Value

type

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

Working Example

Example Snippetpython
import collections.abcimport warningswith warnings.catch_warnings(record=True) as caught:    warnings.simplefilter("always", DeprecationWarning)    result = isinstance(b"AB", collections.abc.ByteString)print(result)
Python Reference