bagof.converters.collections
Converters for collection types (list, tuple, dict, etc.).
Classes
ToIterable
ToSequence
ToSet
Bases: ToIterable
Converter for [abc.Set][bagof.converters.collections.abc.Set].
Sets convert element-wise like any other iterable.
Note
The only difference from
ToIterable is the
concrete fallback, so that an abstract Set[int] hint still
produces a real container (frozenset, since abc.Set is
immutable) rather than a bare iterator.
ToMutableSet
ToMapping
ToTuple
ToLength
Bases: ToSequence[ITERABLE]
Converter for sequences of a fixed length.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
length
|
int
|
The expected length of the sequence. |
required |
hint
|
Any
|
The type hint to convert to. |
UNSET
|