Skip to content

module collections

Source: stdlib/collections.codon


deque[T]

Fields

T: type

Properties

maxlen @property Method is a class property

left @property Method is a class property

Magic methods

__init__(self, arr: Array[T], head: int, tail: int, maxlen: int)

__init__(self)

__init__(self, maxlen: int)

__init__(self, it: Generator[T])

__bool__(self)

__len__(self)

__iter__(self)

__contains__(self, x: T)

__deepcopy__(self)

__copy__(self)

__repr__(self)

__getitem__(self, idx: int)

Methods

appendleft(self, x: T)

append(self, x: T)

popleft(self)

pop(self)

clear(self)

copy(self)


Counter[T]

Fields

T: type

Magic methods

__init__(self, elements: Generator[T])

__init__(self, other: Counter[T])

__init__(self, other: Dict[T, int])

__getitem__(self, key: T)

__delitem__(self, key: T)

__eq__(self, other: Counter[T])

__ne__(self, other: Counter[T])

__copy__(self)

__iadd__(self, other: Counter[T])

__isub__(self, other: Counter[T])

__iand__(self, other: Counter[T])

__ior__(self, other: Counter[T])

__pos__(self)

__neg__(self)

__add__(self, other: Counter[T])

__sub__(self, other: Counter[T])

__and__(self, other: Counter[T])

__or__(self, other: Counter[T])

__repr__(self)

__dict_do_op_throws__(self, key: T, other: Z, op: F, F: type, Z: type)

Methods

elements(self)

most_common(self, n: Optional[int] = None)

subtract(self, elements: Generator[T])

subtract(self, other: Counter[T])

subtract(self, other: Dict[T, int])

update(self, elements: Generator[T])

update(self, other: Counter[T])

update(self, other: Dict[T, int])

update(self)

total(self)


Dict[K,V] @extend Class is extended to add given methods

Magic methods

__init__(self: Dict[K, int], other: Counter[K])


defaultdict[K,V,S]

Fields

default_factory: S

K: type

V: type

S: TypeTrait[CallableTrait[V]]

Magic methods

__init__(self: defaultdict[K, VV, Function[V]], VV: TypeTrait[V])

__init__(self, f: S)

__init__(self: defaultdict[K, VV, Function[V]], VV: TypeTrait[V], other: Dict[K, V])

__init__(self, f: S, other: Dict[K, V])

__missing__(self, key: K)

__getitem__(self, key: K)

__dict_do_op_throws__(self, key: K, other: Z, op: F, F: type, Z: type)

__copy__(self)

__deepcopy__(self)

__eq__(self, other: defaultdict[K, V, S])

__ne__(self, other: defaultdict[K, V, S])

__repr__(self)

Methods

copy(self)


Dict[K,V] @extend Class is extended to add given methods

Magic methods

__init__(self: Dict[K, V], other: defaultdict[K, V, S], S: type)


namedtuple(name: Literal[str], args)