Skip to main content

An immutable dict

Project description

Python Immutable Dict

badge

This library contains the ImmutableDict, a Python dictionary which can't be updated.

How to use it

  1. Install it from pip

pip install adaendra-immutable-dict

  1. Import the AdaendreImmutableDict

from adaendra_immutable_dict.AdaendraImmutableDict import AdaendraImmutableDict

  1. Use it like in the following examples.

Examples

from adaendra_immutable_dict.AdaendraImmutableDict import AdaendraImmutableDict

# Empty Immutable Dict
immutable_dict = AdaendraImmutableDict({})

# Non empty Immutable Dict
immutable_dict = AdaendraImmutableDict({"hello": "world"})

# Get a value
immutable_dict["hello"]
#> world

# Copy dict
immutable_dict_copy = immutable_dict.copy()

# Create an immutable dict from "fromkeys" method
immutable_dict = AdaendraImmutableDict.fromkeys(["a", "b"], "1")

Documentation


Credits

This project is based on Marco Sulla's project: frozen-dict.

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

adaendra_immutable_dict-1.0.0.tar.gz (15.9 kB view hashes)

Uploaded Source

Built Distribution

adaendra_immutable_dict-1.0.0-py3-none-any.whl (16.4 kB view hashes)

Uploaded Python 3

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