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.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6d19b543e3372856a553cc8582ee617b4f1525e2e1cc0f0bc9a6c3577ba7d4f |
|
MD5 | 949cb9dc52775208df288e526a6fe18f |
|
BLAKE2b-256 | 4dfabea800a633b1519c9e5ad3bf3baa128d10052f0a0000450d43ff37868d43 |
Close
Hashes for add_only_dictionary-0.1.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26c867edaa6b35f1fa8c2ff5b536a9b42408cab5534d9d31bb4ee4f3333d37f6 |
|
MD5 | b4b23f773a5cb9a94c9c4ed8b1021e81 |
|
BLAKE2b-256 | 2fb73b6467483c21b33d810678b1254173bb30da3e332d1c6850c655cc30b403 |