Top-rated recipes tagged "meta:requires=_abcoll" and "dict"http://code.activestate.com/recipes/tags/meta:requires=_abcoll+dict/top/2011-08-07T12:14:56-07:00ActiveState Code RecipesYet Another Ordered Dictionary (Python)
2011-08-07T12:14:56-07:00Lucio Santihttp://code.activestate.com/recipes/users/4178886/http://code.activestate.com/recipes/577826-yet-another-ordered-dictionary/
<p style="color: grey">
Python
recipe 577826
by <a href="/recipes/users/4178886/">Lucio Santi</a>
(<a href="/recipes/tags/dict/">dict</a>, <a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/linked_list/">linked_list</a>, <a href="/recipes/tags/ordered/">ordered</a>).
</p>
<p>An implementation of dictionaries preserving key insertion order. Despite using a doubly-linked list to keep track of the appropriate order, this list is actually embedded in the dictionary. As a consequence, there is little space penalty, and also every operation exhibits an efficient implementation (i.e., no need to perform lookups or deletions multiple times, as it happens with other versions of this data structure).</p>