CartesianProduct
takes a variable number of arguments, each argument must be an iterable. So, if your A
is a list of permutation groups, CartesianProduct(*A)
does what you want. Here's an example:
sage: list(CartesianProduct(*(Permutations(i) for i in range(4))))
[[[], [1], [1, 2], [1, 2, 3]],
[[], [1], [1, 2], [1, 3, 2]],
[[], [1], [1, 2], [2, 1, 3]],
[[], [1], [1, 2], [2, 3, 1]],
[[], [1], [1, 2], [3, 1, 2]],
[[], [1], [1, 2], [3, 2, 1]],
[[], [1], [2, 1], [1, 2, 3]],
[[], [1], [2, 1], [1, 3, 2]],
[[], [1], [2, 1], [2, 1, 3]],
[[], [1], [2, 1], [2, 3, 1]],
[[], [1], [2, 1], [3, 1, 2]],
[[], [1], [2, 1], [3, 2, 1]]]