Tags-aware dictionary¶
Contents:
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, valuepairs, tagged bykeytag — that meanskeyis amongvaluefrozenset.Slice with non-empty «start» part (as in
Dict[key:]) generates a sequence of items tagged bykeytagSlice with non-empty «stop» part (as in
Dict[:keys]) generates a sequence of items tagged by all the files inkeyssequenceSlice with non-empty «step» part (as in
Dict[::keys]) generates a sequence of items tagged by any tag fromkeyssequence
Additionally, Tagged[slice] = tags construction is used for adding tags to values, not to change items themselves.
Examples¶
TODO