- Create dictionaries that let you continue adding key/value pairs, but never change existing values or remove existing keys. If a value is a dictionary, that will also be updated to have the same behavior. If the value is a list, items can only be added on to the list, but never removed from any position.
You can install Add Only Dictionary via pip from PyPI:
$ pip install add-only-dictionary
from add_only_dictionary import AODict
regular_dict: Dict = {"a": 1}
ao_dict: AODict = AODict(regular_dict)
ao_dict["b"] = 2 # works!
ao_dict["a"] = 3 # Nothing happens...
ao_dict["a"] == 1 # True, since the key already existed.
This project was generated from @cjolowicz's Hypermodern Python Cookiecutter template.