Skip to main content

Immutable wrapper around dictionaries (a fork of frozendict)

Project description

immutabledict

PyPI Conda PyPI - Python Version

License Build Codecov PyPI - Downloads

A fork of frozendict, an immutable wrapper around dictionaries.

It implements the complete mapping interface and can be used as a drop-in replacement for dictionaries where immutability is desired. The immutabledict constructor mimics dict, and all of the expected interfaces (iter, len, repr, hash, getitem) are provided. Note that an immutabledict does not guarantee the immutability of its values, so the utility of hash method is restricted by usage.

The only difference is that the copy() method of immutable takes variable keyword arguments, which will be present as key/value pairs in the new, immutable copy.

Installation

Available as immutabledict on :

  • pypi
  • conda-forge (community-maintained, not an official release)

Example

from immutabledict import immutabledict

my_item = immutabledict({"a": "value", "b": "other_value"})
print(my_item["a"]) # Print "value"

Differences with frozendict

  • Dropped support of Python < 3.6 (version 1.0.0 supports Python 3.5)
  • Fixed collections.Mapping deprecation warning

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

immutabledict-1.2.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

immutabledict-1.2.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file immutabledict-1.2.0.tar.gz.

File metadata

  • Download URL: immutabledict-1.2.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Linux/5.4.0-1032-gcp

File hashes

Hashes for immutabledict-1.2.0.tar.gz
Algorithm Hash digest
SHA256 1e6bb628eb158d32caf961bed5bb283f9e57201b50f48cd5063175612f0f3efd
MD5 788b733caa79c0e88cd756242827d958
BLAKE2b-256 3f35cd8371cec7a1436b286d4c771c22deb07c7bd70d30148874bd05446ec19b

See more details on using hashes here.

File details

Details for the file immutabledict-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: immutabledict-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Linux/5.4.0-1032-gcp

File hashes

Hashes for immutabledict-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ba015dc189af8aac5921248af18a06d76a1d026e362f917a8e9ee29e8de5133
MD5 0986b131f6567b6498ed7883998e661d
BLAKE2b-256 d068f436601dd9e6990703a61f016af20b9cab153f16eef57414c35159a13c4f

See more details on using hashes here.

Supported by

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