Skip to main content

Shorthand syntax for building OrderedDicts

Project description

https://github.com/epsy/od/actions/workflows/ci.yml/badge.svg?branch=master https://coveralls.io/repos/github/epsy/od/badge.svg?branch=master

The od package adds a shorthand syntax to create instances of OrderedDict

>>> import od
>>>
>>> od["cat": "fish", "mouse": "cheese"]
OrderedDict([('cat', 'fish'), ('mouse', 'cheese')])
>>> od["mouse": "cheese", "cat": "fish"]
OrderedDict([('mouse', 'cheese'), ('cat', 'fish')])

You can also use it like the regular constructor for OrderedDict:

>>> od()
OrderedDict()
>>> an_iterable = [("cat", "fish"), ("mouse", "cheese")]
>>> od(an_iterable)
OrderedDict([('cat', 'fish'), ('mouse', 'cheese')])

Install this package using pip:

$ pip install --user od

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

od-2.0.2.tar.gz (3.2 kB view hashes)

Uploaded source

Built Distribution

od-2.0.2-py3-none-any.whl (3.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page