{"id":2124,"library":"multi-key-dict","title":"Multi-Key Dictionary","description":"multi-key-dict (version 2.0.3) is a Python library that provides a dictionary implementation allowing multiple distinct keys to refer to the same single value. It extends the standard dictionary interface to enable access, update, and deletion of elements via any of its associated keys. The library appears to be in maintenance mode, with its last release in 2015.","status":"maintenance","version":"2.0.3","language":"en","source_language":"en","source_url":"https://github.com/formiaczek/multi_key_dict","tags":["data-structure","dictionary","multi-key","key-value"],"install":[{"cmd":"pip install multi-key-dict","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The primary class to import is 'multi_key_dict'.","symbol":"multi_key_dict","correct":"from multi_key_dict import multi_key_dict"}],"quickstart":{"code":"from multi_key_dict import multi_key_dict\n\nk = multi_key_dict()\nk[1000, 'kilo', 'k'] = 'kilo (x1000)'\n\nprint(f\"Value for key 1000: {k[1000]}\")\nprint(f\"Value for key 'k': {k['k']}\")\n\nk['kilo'] = 'kilo'\nprint(f\"Updated value for key 1000: {k[1000]}\")\n\ndel k[1000]\n# Accessing any other key will now raise a KeyError as the value is deleted\ntry:\n    print(k['kilo'])\nexcept KeyError as e:\n    print(f\"Accessing 'kilo' after deleting by 1000: {e}\")","lang":"python","description":"This example demonstrates how to create a multi-key dictionary, assign a value using multiple keys, access the value via any of its keys, update the value through one key (affecting all associated keys), and delete the value through one key (making it inaccessible via others)."},"warnings":[{"fix":"Understand the core functionality: multi-key-dict maps multiple distinct keys to one unique value. If you need a key to map to a list of values, consider using `list` as a value or explore other 'multidict' implementations if that is the desired behavior.","message":"This library enables multiple *keys* to point to a *single value*. It is not designed for a single key to hold multiple values (like the `multidict` library does for HTTP headers). Attempting to store multiple values for one key will overwrite previous values.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be aware that keys associated with the same value are linked. An update operation on any one of these keys will propagate to all other linked keys. Test thoroughly if this behavior is unexpected for your use case.","message":"Updating a value using any of its associated keys will change the single underlying value. All other keys linked to that original value will then reflect the new updated value.","severity":"gotcha","affected_versions":"All versions"},{"fix":"When deleting an item, understand that you are deleting the shared value, not just the association with a single key. Ensure this is the intended side effect across all linked keys.","message":"Deleting an item via one of its associated keys will remove the underlying value entirely. Consequently, the value will no longer be accessible through any other key that was previously linked to it, resulting in a KeyError.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Assess if the current feature set meets your long-term needs. Consider potential compatibility issues with newer Python versions, though `requires_python: None` suggests broad compatibility. Monitor the GitHub repository for any new activity.","message":"The latest release of multi-key-dict (2.0.3) was published in 2015, indicating a very slow development or maintenance-only cadence. While functional, it might not receive frequent updates or new features.","severity":"deprecated","affected_versions":"2.0.3 and older"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}