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
File details
Details for the file add_only_dictionary-0.2.0.tar.gz
.
File metadata
- Download URL: add_only_dictionary-0.2.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 813203305001fcfb6fed2e458ab0d12fdf5bf4fc04918f3f8287a48570e9d7d5 |
|
MD5 | b8673301d8fbda0e3d8f1912c727e455 |
|
BLAKE2b-256 | 7b82189a5eacdb05ddebf3c57385624b0f5743d30ce35326c1a03e2a0f4587af |
File details
Details for the file add_only_dictionary-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: add_only_dictionary-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 868822d231627fc70df5a4b821a4d107c4555dd5b5e4dfdf275d2236640f39a9 |
|
MD5 | 4d3ad39ef9c00af3fa8e091d8903e507 |
|
BLAKE2b-256 | 1f5f80108e14283b2538e7f3af0dfdcaafd88e646edb9ce1cf448b358597d4c0 |