class product:
def __init__(self, *iterables, repeat=1):
res = [[]]
for item in [list(p) for p in iterables] * repeat:
res = [x + [y] for x in res for y in item]
self.__it = res.__iter__()
def __iter__(self):
return self
def __next__(self):
return tuple(self.__it.__next__())