l, so please test and send pull requests or patches for additional functionality needed. >>> m = BijectiveMap() >>> m['a'] = 'b' >>> m == {'a': 'b', 'b': 'a'} True >>> print(m['b']) a >>> m['c'] = 'd' >>> len(m) 2 Some weird things happen if you map an item to itself or overwrite a single key of a pair, so it's disallowed. >>> m['e'] = 'e' Traceback (most recent call last): ValueError: Key cannot map to itself >>> m['d'] = 'e' Traceback (most recent call last): ValueError: Key/Value pairs may not overlap >>> m['e'] = 'd' Traceback (most recent call last): ValueError: Key/Value pairs may not overlap >>> print(m.pop('d')) c >>> 'c' in m False >>> m = BijectiveMap(dict(a='b')) >>> len(m) 1 >>> print(m['b']) a >>> m = BijectiveMap() >>> m.update(a='b') >>> m['b'] 'a' >>> del m['b'] >>> len(m) 0 >>> 'a' in m False c