As far, as I am able to understand, we are unpacking 3 identical iterators in both cases, but output is different.
In first case, it, for some reason, similar to list(zip(c[::3], c[1::3], c[2::3]))
, in second, it behaves like normal zip()
.
c = [[a, b] for a, b in itertools.product(list(range(3)), list(range(3)))]
# first example
list(zip(*[iter(c)] * 3))
>[([0, 0], [0, 1], [0, 2]), ([1, 0], [1, 1], [1, 2]), ([2, 0], [2, 1], [2, 2])]
# second example
list(zip(*[iter(c), iter(c), iter(c)]))
>[([0, 0], [0, 0], [0, 0]),
([0, 1], [0, 1], [0, 1]),
([0, 2], [0, 2], [0, 2]),
([1, 0], [1, 0], [1, 0]),
([1, 1], [1, 1], [1, 1]),
([1, 2], [1, 2], [1, 2]),
([2, 0], [2, 0], [2, 0]),
([2, 1], [2, 1], [2, 1]),
([2, 2], [2, 2], [2, 2])]