I have a python dictionary which uses a tuple as a dictionary key as follows:
d = {}
d[(0, 'Port')] = 0
d[(1, 'Host')] = 1
Now, in the tuple both the integer and the string are unique across the dictionary i.e. if (0, 'Port')
exists than you will not have an entry (1, 'Port')
. Now, I want to be able to access the value when the user provides just one part of the key (integer or the string).
Would this be possible at all without looping through all the keys?