Tags-aware dictionary¶
Dictionary that uses frozenset of tags as actual key and allows indexing by subset or individual tag. All standard dict operations inherited from dict
, but indexing by slice allows some set operations and returns an iterator.
The following indexing conventions are followed:
When key is a sequence, it first converted to
frozenset()
, then used as an ordinary dictionary keyWhen key is a slice, with non-empty «start» field (as in
Dict[key:]
), the resulting operation is performed over the sequence of items taggedWhen key is a slice, the resulting operation is performed over the sequence of items, i. e.
key, value
pairs, tagged bykey
tag — that meanskey
is amongvalue
frozenset.Slice with non-empty «start» part (as in
Dict[key:]
) generates a sequence of items tagged bykey
tagSlice with non-empty «stop» part (as in
Dict[:keys]
) generates a sequence of items tagged by all the files inkeys
sequenceSlice with non-empty «step» part (as in
Dict[::keys]
) generates a sequence of items tagged by any tag fromkeys
sequence
Additionally, Tagged[slice] = tags
construction is used for adding tags to values, not to change items themselves.
Examples¶
TODO