If a one-to-one dictionary (= bijection) is given, generated Γ la
for key, value in someGenerator: myDict[key] = value
a reverse lookup dictionary can be created trivially by adding
invDict[value] = key
in a for loop. But is this Putin's? Should I instead write a class Bijection(dict) that additionally manages this inverted dictionary and provides a second search function? Or does such a structure (or similar) already exist?
python dictionary
Tobias Kienzler May 28 '13 at 13:36 2013-05-28 13:36
source share