answered 2014-09-02 11:44:12 +0100
You can use itertools.product, as follows:
sage: A = [[1, 2], [3], [4, 5]] sage: import itertools as itl sage: list(itl.product(*A)) [(1, 3, 4), (1, 3, 5), (2, 3, 4), (2, 3, 5)]