I was wondering if Python offers a dictionary-like data structure that allows bidirectional lookup by both key and value and requires that both be unique in their realm. The regular dictionary requires only the key to be unique and the search of keys by a value is not indexed in the same way the other way around is, meaning a full scan is required.
My concrete case scenario is something like a structure of items that have a name and a nickname and, within a structure, both have to be unique (while it is allowed that one item's name be the same as another or the same item's nickname). I need to be able to easily look up a name by a nickname and vice versa and I was wondering if there is a way to do it within a single structure. Of course, I can accomplish it by having two separate structure, one mapping nicknames to names and the other mapping names to nicknames.
There are similar posts but they are old and I was wondering if there have been any developments in the meantime.