Most viewed recipes tagged "1_to_1" Code RecipesFlipdict -- python dict that also maintains a one-to-one inverse mapping (Python) 2009-12-03T14:43:52-08:00Francis Carr <p style="color: grey"> Python recipe 576968 by <a href="/recipes/users/4172444/">Francis Carr</a> (<a href="/recipes/tags/1_to_1/">1_to_1</a>, <a href="/recipes/tags/bijection/">bijection</a>, <a href="/recipes/tags/bijective/">bijective</a>, <a href="/recipes/tags/dict/">dict</a>, <a href="/recipes/tags/injection/">injection</a>, <a href="/recipes/tags/injective/">injective</a>, <a href="/recipes/tags/inverse/">inverse</a>, <a href="/recipes/tags/invert/">invert</a>, <a href="/recipes/tags/mapping/">mapping</a>, <a href="/recipes/tags/one_to_one/">one_to_one</a>). Revision 6. </p> <p>A Flipdict is a python dict subclass that maintains a one-to-one inverse mapping. Each key maps to a unique value, and each value maps back to that same key. Each instance has a "flip" attribute to access the inverse mapping.</p>