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
Consider (frozen)sets: >>> {1, 2} == {2, 1} True >>> unique_items = {frozenset((a, b)) for a in range(3) for b in range(3)} >>> unique_items set([frozenset([0]), frozenset([1, 2]), frozenset([0, 2]), frozenset([1]), frozenset([2]), frozenset([0, 1])]) > On Saturday, July 1, 2017 at 7:00:17 PM UTC+8, Peter Otten wrote: >> Ho Yeung Lee wrote: >> >> > finally i searched dict.values()[index] solved this >> >> That doesn't look like a good solution to anything -- including "this", >> whatever it may be ;) >> >> If you make an effort to better explain your problem in plain english >> rather than with code examples you are likely tho get better answers. -- https://mail.python.org/mailman/listinfo/python-list