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
  • Typing
  • PEP 584 union operators

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-2.2.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

immutabledict-2.2.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: immutabledict-2.2.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.10.0 Linux/5.8.0-1042-azure

File hashes

Hashes for immutabledict-2.2.1.tar.gz
Algorithm Hash digest
SHA256 1ddb0edf1bb6c70d0197eb90ce1fe2b2d58502334f5fdfde72d7c633d723ec3a
MD5 c90adbb556ca3f96be2f15ea3e223592
BLAKE2b-256 60a19250455f34bb4358fe0125814f30fcf27ddb496aab5d1f47eabe45186843

See more details on using hashes here.

File details

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

File metadata

  • Download URL: immutabledict-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.10.0 Linux/5.8.0-1042-azure

File hashes

Hashes for immutabledict-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8d7e32e0bda6dfb846349b78c753b858587c736f46be247d01ccd583ce5cc85b
MD5 caae800add30ce1efbdb92fff4151b03
BLAKE2b-256 eaacb443f0d19088968360df751113fa49646b597ab96ab466d73a281638a877

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