frozendict

Immutable dictionary implementation for Python

pipmacoslinuxwindows
Try with needOr install directly
Source

About

A simple immutable dictionary

Examples

create a dictionary that cannot be modified$ python3 -c "from frozendict import frozendict; d = frozendict({'a': 1}); print(d)"
use dictionary as a key in another dictionary$ python3 -c "from frozendict import frozendict; d = frozendict({'x': 1}); cache = {d: 'value'}; print(cache)"
prevent accidental modifications to dictionary in function$ python3 -c "from frozendict import frozendict; config = frozendict({'debug': False}); print(config['debug'])"
store immutable data in sets$ python3 -c "from frozendict import frozendict; d1 = frozendict({'a': 1}); d2 = frozendict({'b': 2}); s = {d1, d2}; print(s)"