possible pairings in a set

Alan G Isaac alan.isaac at gmail.com
Tue Apr 14 03:04:31 CEST 2009


I cannot access this thread right now so my
answer my be rednundant, but anyway:
http://docs.python.org/library/itertools.html#itertools.combinations

     >>> from itertools import combinations
     >>> print(list(combinations(range(4),2)))
     [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)]

hth,
Alan Isaac



More information about the Python-list mailing list