Peter Otten <__pete...@web.de> wrote: > If you need lookup only I'd prefer tuples, but sometimes you may want to > retrieve all values with a certain k1 and > > d[k1] > > is certainly more efficient than > > [(k2, v) for (k1, k2), v in d.items() if k1 == wanted]
This was the hidden cost of the tuple/reverse-dictionary solution I offered. The solution will of course depend on what the OP requires to be more efficient: looking up keys from values, or working with subsets of the data. -- http://mail.python.org/mailman/listinfo/python-list