Skip to main content

Multi key dictionary implementation

Project description

Implementation of a multi-key dictionary, i.e.:

(key1[,key2, ..]) => value

This dictionary has a similar interface to the standard dictionary => but is extended to support multiple keys referring to the same element.

If element is created using multiple keys, e.g.:

from multi_key_dict import multi_key_dict

k = multi_key_dict()
k[1000, 'kilo', 'k'] = 'kilo (x1000)'

print k[1000] # will print 'kilo (x1000)'
print k['k'] # will also print 'kilo (x1000)'

# the same way objects can be updated, deleted:
# and if an object is updated using one key, the new value will
# be accessible using any other key, e.g. for example above:
k['kilo'] = 'kilo'
print k[1000] # will now print 'kilo' as value was updated

These elements can be accessed using either of those keys (e.g for read/update/deletion).

Multi-key dict provides also extended interface for iterating over items and keys (e.g. by the key type), which might be useful when creating, e.g. dictionaries with index-name key pair allowing to iterate over items using either: names or indexes. It can be useful for many many other similar use-cases, and there is no limit to the number of keys used to map to the value.

There are few other useful methods, e.g. to iterate over dictionary (by/using) selected key type, finding other keys mapping to the same value etc. Refer to example/test code to see it in action.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

multi_key_dict-1.0.2.zip (7.8 kB view details)

Uploaded Source

multi_key_dict-1.0.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

multi_key_dict-1.0.2.win32.exe (204.3 kB view details)

Uploaded Source

File details

Details for the file multi_key_dict-1.0.2.zip.

File metadata

  • Download URL: multi_key_dict-1.0.2.zip
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for multi_key_dict-1.0.2.zip
Algorithm Hash digest
SHA256 b8982aef7a8253426d041c71f36875bc12a19697405214867027b1041adec726
MD5 9d86c0c7577f057c6736c2807944cdd2
BLAKE2b-256 fc9a2e3572ec6b33ffd746adce694514f392b2c849f07c5a11f4f675889b9ea1

See more details on using hashes here.

File details

Details for the file multi_key_dict-1.0.2.tar.gz.

File metadata

File hashes

Hashes for multi_key_dict-1.0.2.tar.gz
Algorithm Hash digest
SHA256 9936b32a393704f1e95994ffcf4bb81cfebcf5a84c88a7f8779904fff87a0d4c
MD5 fcb7aa2efadf61109a19747c984305e5
BLAKE2b-256 569b16f3c2eb760fa8ecbe7d0d5327b832e6f8a23153f8992a8e8d14189199cc

See more details on using hashes here.

File details

Details for the file multi_key_dict-1.0.2.win32.exe.

File metadata

File hashes

Hashes for multi_key_dict-1.0.2.win32.exe
Algorithm Hash digest
SHA256 7c26ea5f237e9299af4cafbb1eedfdf90fa3a5563cd0613ccb0ce27867eb20b4
MD5 96820e383a117249c67399d2ef4cd229
BLAKE2b-256 71b53441d5d8c608108e7d4670cd188fb7573e01f723840ecfd8a0a81a8f535b

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