Here's a generalized solution for r-length combinations avoiding consecutive elements. It gets the entire combinations index for the corresponding shorter list, and then expands the indices of each combination. For example, for r = 3, any combination (x, y, z) turns into the used indices x + 0, y + 1, z + 2.
from itertools import combinations def non_consecutive_combinations(lst, r): return [tuple(lst[j+i] for i, j in enumerate(combi)) for combi in combinations(range(len(lst)-r+1), r)]
Demo for r = 2:
>>> non_consecutive_combinations([1, 2, 3, 4, 5], 2) [(1, 3), (1, 4), (1, 5), (2, 4), (2, 5), (3, 5)]
Demo for r = 3:
>>> non_consecutive_combinations([1, 2, 3, 4, 5, 6, 7], 3) [(1, 3, 5), (1, 3, 6), (1, 3, 7), (1, 4, 6), (1, 4, 7), (1, 5, 7), (2, 4, 6), (2, 4, 7), (2, 5, 7), (3, 5, 7)]
Simplified version for couples only:
>>> [(lst[i], lst[j+1]) for i, j in combinations(range(len(lst)-1), 2)] [(1, 3), (1, 4), (1, 5), (2, 4), (2, 5), (3, 5)]