Skip to content
Search

Python:collections

lastmod 2021-05-15created 2021-05-095 edits

Collections abstract base classes

The collections module provides the following ABCs:

ABC

Inherits from

Abstract methods

Mixin methods

Container

contains

Hashable

hash

Iterable

iter

Iterator

Iterable

next

iter

Reversible

Iterable

reversed

Generator

Iterator

send, throw

close, iter, next

Sized

len

Callable

call

Collection

Sized, Iterable, Container

contains, iter, len

Sequence

Reversible, Collection

getitem, len

contains, iter, reversed, index, and count

MutableSequence

Sequence

getitem, setitem, delitem, len, insert

Inherited Sequence methods and append, reverse, extend, pop, remove, and iadd

ByteString

Sequence

getitem, len

Inherited Sequence methods

Set

Collection

contains, iter, len

le, lt, eq, ne, gt, ge, and, or, sub, xor, and isdisjoint

MutableSet

Set

contains, iter, len, add, discard

Inherited Set methods and clear, pop, remove, ior, iand, ixor, and isub

Mapping

Collection

getitem, iter, len

contains, keys, items, values, get, eq, and ne

MutableMapping

Mapping

getitem, setitem, delitem, iter, len

Inherited Mapping methods and pop, popitem, clear, update, and setdefault

MappingView

Sized

len

ItemsView

MappingView, Set

contains, iter

KeysView

MappingView, Set

contains, iter

ValuesView

MappingView, Collection

contains, iter

Awaitable

await

Coroutine

Awaitable

send, throw

close

AsyncIterable

aiter

AsyncIterator

AsyncIterable

anext

aiter

AsyncGenerator

AsyncIterator

asend, athrow

aclose, aiter, anext

deque

See also

author Zer0 sitemap