from itertools import product

def gen(l):
	return product(*map(range, l))

print(list(gen([1, 2, 3])))