Top-rated recipes tagged "datastructures" and "dictionary"http://code.activestate.com/recipes/tags/datastructures+dictionary/top/2015-10-15T15:45:16-07:00ActiveState Code Recipesdefdict (Python)
2015-10-15T15:45:16-07:00userhttp://code.activestate.com/recipes/users/4187240/http://code.activestate.com/recipes/579113-defdict/
<p style="color: grey">
Python
recipe 579113
by <a href="/recipes/users/4187240/">user</a>
(<a href="/recipes/tags/abstract_base_class/">abstract_base_class</a>, <a href="/recipes/tags/datastructures/">datastructures</a>, <a href="/recipes/tags/dictionary/">dictionary</a>).
</p>
<p>default dictionary with collision function to handle key collisions.</p>
Restricted dictionary (Python)
2012-02-16T21:39:02-08:00arnoqueshttp://code.activestate.com/recipes/users/4180947/http://code.activestate.com/recipes/578042-restricted-dictionary/
<p style="color: grey">
Python
recipe 578042
by <a href="/recipes/users/4180947/">arnoques</a>
(<a href="/recipes/tags/datastructures/">datastructures</a>, <a href="/recipes/tags/dict/">dict</a>, <a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/record/">record</a>).
</p>
<p>It's a dictionary that's restricted to a tuple of allowed keys. Any attempt to set an invalid key raises an error.</p>