🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

adaendra-immutable-dict

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adaendra-immutable-dict

An immutable dict

1.0.0
Maintainers
1

Python Immutable Dict

badge

This library contains the ImmutableDict, a Python dictionary which can't be updated.

How to use it

  • Install it from pip

pip install adaendra-immutable-dict

  • Import the AdaendreImmutableDict

from adaendra_immutable_dict.AdaendraImmutableDict import AdaendraImmutableDict

  • Use it like in the following examples.

Examples

from adaendra_immutable_dict.AdaendraImmutableDict import AdaendraImmutableDict

# Empty Immutable Dict
immutable_dict = AdaendraImmutableDict({})

# Non empty Immutable Dict
immutable_dict = AdaendraImmutableDict({"hello": "world"})

# Get a value
immutable_dict["hello"]
#> world

# Copy dict
immutable_dict_copy = immutable_dict.copy()

# Create an immutable dict from "fromkeys" method
immutable_dict = AdaendraImmutableDict.fromkeys(["a", "b"], "1")

Documentation

Credits

This project is based on Marco Sulla's project: frozen-dict.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts