class BidirectionalDict(dict):

    def __setitem__(self, key, val):
        dict.__setitem__(self, key, val)
dict.__setitem__(self, val, key)

def __delitem__(self, key):
    dict.__delitem__(self, self[key])
dict.__delitem__(self, key)
d = BidirectionalDict()
d['foo'] = 4
Обратимый словарь для python