collections

Standard library module View source
class deque
class deque[T]
Fields 1
T type
Constructors 4
__init__
__init__(self)
__init__
__init__(self, maxlen: int)
__init__
__init__(self, it: Generator[T])
__init__
__init__(self, other: deque[T])
Properties 2
maxlen
@property
maxlen(self)
left
@property
left(self)
Methods 6
appendleft
appendleft(self, x: T)
append
append(self, x: T)
popleft
popleft(self)
pop
pop(self)
clear
clear(self)
copy
copy(self)
Special methods 8
__bool__
__bool__(self)
__len__
__len__(self)
__iter__
__iter__(self)
__contains__
__contains__(self, x: T)
__deepcopy__
__deepcopy__(self)
__copy__
__copy__(self)
__repr__
__repr__(self)
__getitem__
__getitem__(self, idx: int)
class Counter
class Counter[T]
Fields 1
T type
Constructors 3
__init__
__init__(self, elements: Generator[T])
__init__
__init__(self, other: Counter[T])
__init__
__init__(self, other: OrderedDict[T, int])
Methods 5
elements
elements(self)
most_common
most_common(self, n: Optional[int] = None)
subtract
subtract(self, elements: Generator[T])
subtract(self, other: Counter[T])
subtract(self, other: OrderedDict[T, int])
update
update(self, elements: Generator[T])
update(self, other: Counter[T])
update(self, other: OrderedDict[T, int])
update(self)
total
total(self)
Special methods 17
__getitem__
__getitem__(self, key: T)
__delitem__
__delitem__(self, key: T)
__eq__
__eq__(self, other: Counter[T])
__ne__
__ne__(self, other: Counter[T])
__copy__
__copy__(self)
__iadd__
__iadd__(self, other: Counter[T])
__isub__
__isub__(self, other: Counter[T])
__iand__
__iand__(self, other: Counter[T])
__ior__
__ior__(self, other: Counter[T])
__pos__
__pos__(self)
__neg__
__neg__(self)
__add__
__add__(self, other: Counter[T])
__sub__
__sub__(self, other: Counter[T])
__and__
__and__(self, other: Counter[T])
__or__
__or__(self, other: Counter[T])
__repr__
__repr__(self)
__dict_do_op_throws__
__dict_do_op_throws__(self, key: T, other: Z, op: F, F: type, Z: type)
class defaultdict
class defaultdict[K, V, S]
Fields 4
default_factory S
K type
V type
S TypeTrait[CallableTrait[V]]
Constructors 4
__init__
__init__(self: defaultdict[K, VV, Function[V]], VV: TypeTrait[V])
__init__
__init__(self, f: S)
__init__
__init__(self: defaultdict[K, VV, Function[V]], VV: TypeTrait[V], other: OrderedDict[K, V])
__init__
__init__(self, f: S, other: OrderedDict[K, V])
Methods 1
copy
copy(self)
Special methods 8
__missing__
__missing__(self, key: K)
__getitem__
__getitem__(self, key: K)
__dict_do_op_throws__
__dict_do_op_throws__(self, key: K, other: Z, op: F, F: type, Z: type)
__copy__
__copy__(self)
__deepcopy__
__deepcopy__(self)
__eq__
__eq__(self, other: defaultdict[K, V, S])
__ne__
__ne__(self, other: defaultdict[K, V, S])
__repr__
__repr__(self)
function namedtuple
namedtuple(name: Literal[str], args)