Skip to main content

defaultdict

Standard library class collections.defaultdict View source
class defaultdict
@tuple
class defaultdict[K, V, S]
Fields 4
default_factory S
K type
V type
S TypeTrait[CallableTrait[([], V)]]
Constructors 8
__new__
__new__[VV: TypeTrait[V]]() -> defaultdict[(K, VV, Function[([], V)])]
Defined in collections
__new__
__new__(f: S, /) -> defaultdict[(K, V, S)]
Defined in collections
__new__
__new__[VV: TypeTrait[V]](other: Dict[(K, V)], /) -> defaultdict[(K, VV, Function[([], V)])]
Defined in collections
__new__
__new__(f: S, other: Dict[(K, V)], /) -> defaultdict[(K, V, S)]
Defined in collections
__new__
__new__[VV: TypeTrait[V], F: type](other: defaultdict[(K, V, F)], /) -> defaultdict[(K, VV, Function[([], V)])]
Defined in collections
__new__
__new__[F: type](f: S, other: defaultdict[(K, V, F)], /) -> defaultdict[(K, V, S)]
Defined in collections
__new__
__new__[VV: TypeTrait[V]](other: Counter[K], /) -> defaultdict[(K, VV, Function[([], V)])]
Defined in collections
__new__
__new__(f: S, other: Counter[K], /) -> defaultdict[(K, V, S)]
Defined in collections
Methods 13
keys
keys(self: Self, /)
Defined in collections
values
values(self: Self, /)
Defined in collections
items
items(self: Self, /)
Defined in collections
get
get(self: Self, key: K, /)
Defined in collections
get(self: Self, key: K, default: V, /)
Defined in collections
setdefault
setdefault(self: Self, key: K, value: V, /)
Defined in collections
pop
pop(self: Self, key: K, /)
Defined in collections
pop(self: Self, key: K, missing, /)
Defined in collections
popitem
popitem(self: Self, /)
Defined in collections
clear
clear(self: Self, /)
Defined in collections
resize
resize(self: Self, minused: int)
Defined in collections
increment
increment[Z: type](self: Self, key: K, by: Z = 1)
Defined in collections
update
update(self: Self, other, /)
Defined in collections
fromkeys
fromkeys[K: type, V: type](ks: Generator[K], v: V, /)
Defined in collections
copy
copy(self: Self, /)
Defined in collections
Special methods 18
__len__
__len__(self: Self, /)
Defined in collections
__bool__
__bool__(self: Self)
Defined in collections
__iter__
__iter__(self: Self, /)
Defined in collections
__reversed__
__reversed__(self: Self, /)
Defined in collections
__contains__
__contains__(self: Self, key: K, /)
Defined in collections
__setitem__
__setitem__(self: Self, key: K, value: V, /)
Defined in collections
__delitem__
__delitem__(self: Self, key: K, /)
Defined in collections
__or__
__or__(self: Self, other, /)
Defined in collections
__ior__
__ior__(self: Self, other, /)
Defined in collections
__missing__
__missing__(self: Self, key: K, /)
Defined in collections
__getitem__
__getitem__(self: Self, key: K, /) -> V
Defined in collections
__dict_do_op_throws__
__dict_do_op_throws__[F: type, Z: type](self: Self, key: K, other: Z, op: F)
Defined in collections
__dict_do_op__
__dict_do_op__[F: type, Z: type](self: Self, key: K, other: Z, default: V, op: F)
Defined in collections
__copy__
__copy__(self: Self, /)
Defined in collections
__deepcopy__
__deepcopy__(self: Self)
Defined in collections
__eq__
__eq__[F: type](self: Self, other: defaultdict[(K, V, F)], /) -> bool
Defined in collections
__eq__(self: Self, other: Dict[(K, V)], /) -> bool
Defined in collections
__eq__(self: Self, other: Counter[K], /) -> bool
Defined in collections
__ne__
__ne__[F: type](self: Self, other: defaultdict[(K, V, F)], /) -> bool
Defined in collections
__ne__(self: Self, other: Dict[(K, V)], /) -> bool
Defined in collections
__ne__(self: Self, other: Counter[K], /) -> bool
Defined in collections
__repr__
__repr__(self: Self, /)
Defined in collections