> is there in python a kind of dictionary that supports key - key pairs? > I need a dictionary in which I can access a certain element using two > different keys, both unique. > A Python dictionary needs a unique key, so a pair of keys is still one unique key, but probably it is some kind of misunderstanding here, because a dictionary is not a database which needs a key to quickly find an entry, so it can have as many keys as required.
What about two dictionaries where each has as a value a key to the target dictionary with the actual values? > For example: > > I've a dictionary with strings and times. Sometimes I have the string and I > want to have the time, other time I've the time and I want the string. It > is important that one of the keys supports the min/max builtin function. >From this example it seems, that what is needed is a two-way dictionary. I don't know about a special kind of dictionary for this, so maybe someone else knows about such. I can only recommend to use two dictionaries, where the second one is created out of the first one, so that they key, value pair is reversed. If you need some code for the latter, let me know. Claudio "Florian Lindner" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Hello, > is there in python a kind of dictionary that supports key - key pairs? > I need a dictionary in which I can access a certain element using two > different keys, both unique. > > For example: > > I've a dictionary with strings and times. Sometimes I have the string and I > want to have the time, other time I've the time and I want the string. It > is important that one of the keys supports the min/max builtin function. > > Thanks, > > Florian -- http://mail.python.org/mailman/listinfo/python-list