Skip to main content

Dictionary-like container with support for duplicate keys and optional key sorting.

Project description

pymultimap

PyPI - Version PyPI - Python Version


Table of Contents

MultiMap

Python dictionary-like container with support for duplicate keys and optional key sorting.

Installation

pip install pymultimap

Usage

from pymultimap import MultiMap

mm = MultiMap()
mm["a"] = 1
mm["a"] = 2
mm["b"] = 3

print(mm)

Output:

{a: [1, 2], b: [3]}
from pymultimap import MultiMap

sorted_multimap = MultiMap(sorted=True, reverse=True)
sorted_multimap["a"] = 1
sorted_multimap["c"] = 3
sorted_multimap["b"] = 2

print(sorted_multimap)

Output:

{c: [3], b: [2], a: [1]}

mm[key] always returns the list of values associated with that key. When sorted=True, keys are ordered by key value, and reverse=True is available only with sorted maps.

License

pymultimap is distributed under the terms of 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

pymultimap-0.0.9.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

pymultimap-0.0.9-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file pymultimap-0.0.9.tar.gz.

File metadata

  • Download URL: pymultimap-0.0.9.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pymultimap-0.0.9.tar.gz
Algorithm Hash digest
SHA256 b4c4c9ec165816bfcf9c06fd2f396793bfc00826c9926756bb9d2a6bb40f61f3
MD5 ea5f031c5f3137a14eca6c29de4d6ab9
BLAKE2b-256 f5c622603b9ce0d6aa535d4e2e4f783fa5302655c8be59ceae8058ec222cd76d

See more details on using hashes here.

File details

Details for the file pymultimap-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: pymultimap-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pymultimap-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 473946abe77d46c4dab82448310f6bc7e1b191d2ade46732eb78036b0f401621
MD5 32b1e78ee640e076562f87e3460bfc75
BLAKE2b-256 0b98b29319d41aaf9d2c85e8a6be78be1f49f336990b93658700e364f1cc7ee2

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