Skip to main content

Add Only Dictionary

Project description

Add Only Dictionary

PyPI Status Python Version License

Read the documentation at https://add-only-dictionary.readthedocs.io/ Tests Codecov

pre-commit Black

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

add_only_dictionary-0.1.6.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

add_only_dictionary-0.1.6-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file add_only_dictionary-0.1.6.tar.gz.

File metadata

  • Download URL: add_only_dictionary-0.1.6.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

Hashes for add_only_dictionary-0.1.6.tar.gz
Algorithm Hash digest
SHA256 f0beba10939e9c8a838ad2d5d8d4ca7e046bf919c4636cc6f77680e6e9b035ee
MD5 48dbaf54b4e73632d9dd1c875f3b98dd
BLAKE2b-256 2fb9c70c37bf15b9259dc5d80928e5ca7f059447b843c446bf701c15dfb40c9a

See more details on using hashes here.

File details

Details for the file add_only_dictionary-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for add_only_dictionary-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c0a97501ced9a5f9db9e8fe00f2ad7ef4e5b1f68bf4c33abcd409b0d1a87bb58
MD5 bd40030e9244448516cc43059b7fb4df
BLAKE2b-256 1dced26f4ad4c1a2ac417a99f75c4734d648b804e20b4e5feca89aeda430e7b5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page