Commits

Thomas Kluyver committed 94a6b5e

Simple, but slower, two way dict--it's only really for reprs for interactive use, so speed isn't a big issue.

  • Participants
  • Parent commits cbe485c

Comments (0)

Files changed (1)

 import networkx as nx
-from two_way_dict import TwoWayDict
+#from two_way_dict import TwoWayDict
 
 LOAD_TDWG = True
 
+class TwoWayDict(dict):
+    def get_key(self, value):
+        for k, v in self.items():
+            if v == value:
+                return k
+        raise ValueError(value)
+
 class Region(object):
     def __init__(self, code, inmap):
         self.code = code