Skip to main content

Shorthand syntax for building OrderedDicts

Project description

https://travis-ci.org/epsy/od.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


Release history Release notifications

This version

1.0

Download files

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

Files for od, version 1.0
Filename, size File type Python version Upload date Hashes
Filename, size od-1.0-py3-none-any.whl (3.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size od-1.0.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page