Kitchen.collections¶
StrictDict¶
kitchen.collections.StrictDict
provides a dictionary that treats
str
and unicode
as distinct key values.
-
class
kitchen.collections.strictdict.
StrictDict
¶ Map class that considers
unicode
andstr
different keysOrdinarily when you are dealing with a
dict
keyed on strings you want to have keys that have the same characters end up in the same bucket even if one key isunicode
and the other is a bytestr
. The normaldict
type does this for ASCII characters (but not for anything outside of the ASCII range.)Sometimes, however, you want to keep the two string classes strictly separate, for instance, if you’re creating a single table that can map from
unicode
characters tostr
characters and vice versa. This class will help you do that by making allunicode
keys evaluate to a different key than allstr
keys.See also
dict
- for documentation on this class’s methods. This class implements
all the standard
dict
methods. Its treatment ofunicode
andstr
keys as separate is the only difference.