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-2.0.zip (9.9 kB view details)

Uploaded Source

multi_key_dict-2.0.tar.gz (8.3 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-2.0.win32.exe (206.7 kB view details)

Uploaded Source

File details

Details for the file multi_key_dict-2.0.zip.

File metadata

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

File hashes

Hashes for multi_key_dict-2.0.zip
Algorithm Hash digest
SHA256 2e8fcc56f1249ece580fee03e67a655694ef1dec220e9cd0d88f6a4b6735ff4b
MD5 2c4d6e114995fd6a36e875b4cdb3eb7a
BLAKE2b-256 42462885342011bd60550a6f00a0721fdc8afc6a470146a94fa3e8bf6e6b6d39

See more details on using hashes here.

File details

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

File metadata

  • Download URL: multi_key_dict-2.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for multi_key_dict-2.0.tar.gz
Algorithm Hash digest
SHA256 f5d7baebbde80157052f889ab41b3f5a866961e1c84797794035ffc9de95cd20
MD5 cc9982871495abf6721d87ffbeb9f491
BLAKE2b-256 b4981cd9c7a5b0af2e6ee7713486daf8ca4c38573e5b1a326e1c4e11e1e9dca5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for multi_key_dict-2.0.win32.exe
Algorithm Hash digest
SHA256 d6825a58a0a43c5144f8ba165fcdd3cb5dfa3f199064ff4dc552f2c9131bb205
MD5 d3353ee362c54f1a018ccaab8e5c6a28
BLAKE2b-256 84d8451842a5496844bb5c7634b231a2e4caf0d867d2e25f09b840d3b07f3d4b

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