Immutable wrapper around dictionaries (a fork of frozendict)
Project description
immutabledict
A fork of the original frozendict, an immutable wrapper around dictionaries. This library is a pure Python, MIT-licensed alternative to the new LGPL-3.0 licensed frozendict.
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)
- alpine as py3-immutabledict (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 the old original frozendict package
- Dropped support of EOL Python versions (version 1.0.0 supports Python 3.5, versions <= 2.2.1 supports Python 3.6)
- 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.4.tar.gz.
File metadata
- Download URL: immutabledict-2.2.4.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-1034-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bedc0741faaa2846f6edf5c29183f993da3abaff6a5961bb70a5659bb9e68ab
|
|
| MD5 |
f571ad2050279f2762ec11e9586e1358
|
|
| BLAKE2b-256 |
ab96548ee1a774062b2bec740ef03ab427f20e802d66b1db23a42ba20cb88121
|
File details
Details for the file immutabledict-2.2.4-py3-none-any.whl.
File metadata
- Download URL: immutabledict-2.2.4-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-1034-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c827715c147d2364522f9a7709cc424c7001015274a3c705250e673605bde64b
|
|
| MD5 |
1674f801c2da1293949e5f2304a36ecf
|
|
| BLAKE2b-256 |
04087c5af841703fe40ff68cd6a5d1746ecb8037b495e8685d8b74565cb7d3c7
|