(1..3).to_a.permutation(2).to_a => [[1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2]]
>>> [i for i in itertools.permutations([1,2,3], 2)] [(1, 2), (1, 3), (2, 1), (2, 3), (3, 1), (3, 2)]