More picky version of Python dictionary.
Project description
pickydict
More picky version of Python dictionary
PickyDict objects will behave just like Python dictionaries, with a few notable exceptions:
(1) PickyDict has a force_lower_case attribute. If set to True (default) then dictionary keys will all be treated as lower-case.
(2) PickyDict can contain a second dictionary named "replacements" with mappings to enforce translating specific key words.
Examples:
from pickydict import PickyDict
# per default force_lower_case is set to True:
my_dict = PickyDict({"A": 1, "B": 2})
print(my_dict) # => {'a': 1, 'b': 2}
# now also using a replacements dictionary
my_dict = PickyDict({"A": 1, "B": 2},
replacements={"a": "abc", "b": "bcd", "c": "cde"})
print(my_dict) # => {'abc': 1, 'bcd': 2}
my_dict["c"] = 100
print(my_dict) # => {'abc': 1, 'bcd': 2, , 'cde': 100}
my_dict["b"] = 5 # => ValueError: Key 'b' will be interpreted as 'bcd'...
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pickydict-0.1.0.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for pickydict-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37cc13fea87a2e764a4966e403efeebac7ed98eb41286e0deab8bc4981ff3e77 |
|
MD5 | 615e481fd1c1877f59578b5683d9e172 |
|
BLAKE2b-256 | 9d11513524e249008dec2523c5caa0b06e5a4a6ac2ba9194abdb4861ff4ecbf2 |