On Saturday, July 1, 2017 at 1:46:21 PM UTC+1, Ho Yeung Lee wrote: > just want to compare tuples like index (0,1), (0,2), (1,2) without duplicate > such as (2,0), (1,0) etc >
I'm still not entirely sure what you're asking, but can't you just generate what you want with itertools combinations, something like:- >>> import itertools >>> tuples = list(itertools.combinations(range(3), 2)) >>> tuples [(0, 1), (0, 2), (1, 2)] -- https://mail.python.org/mailman/listinfo/python-list