I would like to generate combinations of length k, from a set of N numbers, where order matters and numbers can be replaced. For example if k = 3, and N = [1, 2, 3], then candidate outputs would include, for example, (1, 1, 1), (2, 2, 2), (3, 2, 1), (1, 2, 3).
I believe I'm nearly there with the following code
x = list(itertools.combinations_with_replacement(range(1,4),3)
But this gives results where order does not matter - i.e it thinks (1, 2, 3) is the same as (3, 2, 1), (2, 3, 1) etc etc.
Any help much appreciated!