Skip to main content

An immutable, hashable, and ordered mapping.

Project description

frozen-odict

An immutable, hashable, and ordered mapping.

FrozenOdict behaves similarly to an OrderedDict but is immutable and hashable, making it suitable for use as dictionary keys or set members.

Installation

pip install frozen-odict

Usage

from frozen_odict import FrozenOdict

# Create from a mapping
fod1 = FrozenOdict({'a': 1, 'b': 2})

# Create from sequence of pairs
fod2 = FrozenOdict([('x', 100), ('y', 200)])

# Create with keyword arguments
fod3 = FrozenOdict({'foo': 42}, bar=43)

# Hashable and set-usable
s = {fod1, fod2}
if fod1 in s:
    print("Found!")

# Works as dictionary keys!
d = {fod1: "first", fod2: "second"}

print(fod1)  # FrozenOdict([('a', 1), ('b', 2)])

Contributing

Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.

License

This project is licensed under the MIT License.

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

frozen_odict-0.1.0a0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

frozen_odict-0.1.0a0-py2.py3-none-any.whl (4.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file frozen_odict-0.1.0a0.tar.gz.

File metadata

  • Download URL: frozen_odict-0.1.0a0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for frozen_odict-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 2517bce359ae227f99cb6d30244b872b9716719ffb8b51e09f8e12a5629be088
MD5 4ea9305bc974a567607361b39a225006
BLAKE2b-256 93b8c942533908913b95c9e8243686978ee194c100f303e77bbcff52057202a5

See more details on using hashes here.

File details

Details for the file frozen_odict-0.1.0a0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for frozen_odict-0.1.0a0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b0670d0398c5aa9a4b8c147153626b422e508a4ee54cd07c74d37f433373530c
MD5 dbdaa25076f34a8496fbdacbd3853eb2
BLAKE2b-256 c3bb7771574a56aa4bdffb0697cd25049242a0001cf527f137e14b1e8dfb61fb

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