orderedmultidict is a Python library that provides an `omdict` class, an ordered multivalue dictionary. It retains the insertion order of both keys and their associated values, and aims for method parity with Python's built-in `dict`. The library is known for powering `furl` and supports both Python 2 and Python 3 environments. The current version is 1.0.2, with the last release dating back to 2019, indicating an infrequent release cadence.
pip install orderedmultidictVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic instantiation, adding multiple values to a key, and accessing values while preserving insertion order.
Consider migrating to more actively maintained alternatives if long-term support or compatibility with recent Python versions is required.
For performance-critical applications, evaluate alternatives like `better-orderedmultidict` (PyPI: `better-orderedmultidict`) or `werkzeug.datastructures.MultiDict`, which offer improved speed and active development.
For scenarios only requiring ordered keys with single values, a standard `dict` in Python 3.7+ may suffice. For multi-value requirements, assess if a `dict` of lists adequately meets needs before opting for a specialized multidict.
Install the package using pip: `pip install orderedmultidict`
Import the `omdict` class explicitly: `from orderedmultidict import omdict`
Use the `getlist()` method to retrieve all values associated with a key as a list: `omd.getlist(key)`
Before accessing a key, check if it exists using `if key in omdict_instance:` or use the `get()` method with a default value: `omd.get(key, default_value)`
No dependency data recorded yet.