Immutable wrapper around dictionaries (a fork of frozendict)
Project description
immutabledict
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.Mappingdeprecation warning - Typing
- PEP 584 union operators
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ddb0edf1bb6c70d0197eb90ce1fe2b2d58502334f5fdfde72d7c633d723ec3a
|
|
| MD5 |
c90adbb556ca3f96be2f15ea3e223592
|
|
| BLAKE2b-256 |
60a19250455f34bb4358fe0125814f30fcf27ddb496aab5d1f47eabe45186843
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d7e32e0bda6dfb846349b78c753b858587c736f46be247d01ccd583ce5cc85b
|
|
| MD5 |
caae800add30ce1efbdb92fff4151b03
|
|
| BLAKE2b-256 |
eaacb443f0d19088968360df751113fa49646b597ab96ab466d73a281638a877
|