collectionsOrderedDict
collections.OrderedDict is a dict-like class from Python's standard library (the collections module) that records the order in which keys are inserted. Iterating over an OrderedDict yields items in that insertion order, even after updates or deletions. Although Python's built-in dict now preserves insertion order, OrderedDict provides additional methods for reordering and for modeling ordered data structures.
Internally, OrderedDict uses a doubly linked list to maintain element order while a separate dictionary provides
Typical usage is to create a cache or otherwise manage items in a defined order. For example:
With Python 3.7 and later, plain dicts preserve insertion order, reducing the need for OrderedDict in many