On Apr 26, 5:32 pm, bearophileh...@lycos.com wrote: > 3) xpairs(seq)
> >>> list(xpairs(range(5))) > [(0, 1), (0, 2), (0, 3), (0, 4), (1, 2), (1, 3), (1, 4), (2, 3), > (2, 4), (3, 4)] Doesn't itertools.combinations already do this for you? >>> list(itertools.combinations(range(5), 2)) [(0, 1), (0, 2), (0, 3), (0, 4), (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)] Mark -- http://mail.python.org/mailman/listinfo/python-list