Collection

General purpose utilities

Indexable Dictionary

class mhi.enerplot.common.collection.IndexableDict

An ordered dictionary, where values can be retrieved by index as well as by key:

>>> idict = IndexableDict([('foo', 10), ('bar', 30), ('baz', 20)])
>>> idict['foo'] == idict[0] == idict[-3] == 10
True
>>> idict['bar'] == idict[1] == idict[-2] == 30
True
>>> idict['baz'] == idict[2] == idict[-1] == 20
True