Add Only Dictionary
Project description
Add Only Dictionary
Features
- 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.
Installation
You can install Add Only Dictionary via pip from PyPI:
$ pip install add-only-dictionary
Usage
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.
Credits
This project was generated from @cjolowicz's Hypermodern Python Cookiecutter template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for add_only_dictionary-0.1.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4078b5a0d38a0f6c9ccc54ad8b3e39d78df439d9e3fc82f0ef82e42e53faf33b |
|
MD5 | fce39f01fb7f2248f1c34b844879323d |
|
BLAKE2b-256 | 0735547b450d817a0b91cdf28ad7aa2b52df14d2b12f0c43318d9a998a23a773 |
Close
Hashes for add_only_dictionary-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd3069dc9eb4373eed2e2331f94a6bfa4b8142b3bb80a3a88ee6be05e781811c |
|
MD5 | b0814a80cf87f7376c6c92e97d503b6f |
|
BLAKE2b-256 | fc261baf66473c5b67cc169487f0ad0c73f0b6067fae11d3e724a8c00be23a24 |