Larry.Mart wrote: > Since there are duplicates, I can't use a dict. And if I have any > extraneous data in the keys (i.e. something to make them unique) then > I still have to walk through the entire dict to find the matches.
You can use slightly different approach. With double mapping you could simplify the lookup. What I mean? Get the first set and build lookup map as: MAP := { KEY1-VALUE : { KEY2-VALUE : [SET, SET, n-th duplicate SET] } } In the worst case you would have quadratic complexity of the algorithm. Otherwise the lookup would be really fast. -- http://mail.python.org/mailman/listinfo/python-list