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
unicodeandstrdifferent keysOrdinarily when you are dealing with a
dictkeyed on strings you want to have keys that have the same characters end up in the same bucket even if one key isunicodeand the other is a bytestr. The normaldicttype 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
unicodecharacters tostrcharacters and vice versa. This class will help you do that by making allunicodekeys evaluate to a different key than allstrkeys.See also
dict- for documentation on this class’s methods. This class implements
all the standard
dictmethods. Its treatment ofunicodeandstrkeys as separate is the only difference.