Skip to main content

A tidier way of coding literal OrderedDicts

Project description

Provides a nice way of specifying ordered dictionaries from Python source.

Example:

>>> from odictliteral import odict
>>> x = odict[1:2,3:4]
>>> print(x)
odict[1: 2, 3: 4]

You can use odict as a replacement for OrderedDict otherwise, eg:

>>> y = odict( [(1,2), (3,4)] )
>>> print(y)
odict[1: 2, 3: 4]
>>> x == y
True

You should also be able to use odict in combination with OrderedDicts:

>>> z = OrderedDict( [(1,2), (3,4)] )
>>> print(z)
OrderedDict([(1, 2), (3, 4)])
>>> y == z
True

That’s pretty much all there is to it. Should be compatible with Python 2.7 and Python 3; requires the “ordereddict” module to work with Python 2.4, 2.5 or 2.6.

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

odictliteral-1.0.0.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file odictliteral-1.0.0.tar.gz.

File metadata

File hashes

Hashes for odictliteral-1.0.0.tar.gz
Algorithm Hash digest
SHA256 88405c7fab7ff7a54c7b9fac9fd69264e526b0024b8265bc042ba3a797f0c161
MD5 818bbf5ce787c9f258fcc38a9c42ba61
BLAKE2b-256 11718752b9e8a7bd25112b1e676b81b9d05df5299f6f8305c868eec7f656bcc2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page