Ordered dictionary class, from a recipe in the Python Cookbook.
Ordered dictionary class, compatible with the builtin dict. The order in which items are added to the Odict is preserved.
Create an Odict from the given keys and values.
Remove all items from the Odict.
Return an exact copy of the Odict.
Return a list of (key, value) pairs, in order.
Return the list of keys, in order.
Pop the item with the given key and return it.
Pop the last (key, value) pair from the Odict, and return it.
If Odict[key] doesn’t exist, set Odict[key] = failobj, and return the resulting value of Odict[key].
Update the Odict with values from another dict.
Return the list of values, in order.
Convert a list of choices to an Odict (ordered dictionary). choices may be in one of several formats:
- string
- 'one|two|three'
- list
- ['one', 'two', 'three']
- dict
- {'a': "Choice A", 'b': "Choice B"}
- list-of-lists
- [['a', "Choice A"], ['b', "Choice B"], ..]
Note: the dict form does not preserve order. Use list-of-lists to maintain the specified order.