I have the code below to get an infinite generator of the products of an iterable (e.g. for the iterable "ABC" it should return
A, B, C, AA, AB, AC, BA, BB, BC, CA, CB, CC, AAA, AAB, AAC etc.
for product in (itertools.product("ABC", repeat=i) for i in itertools.count(0)):
for each_tuple in product:
print(each_tuple)
How would I remove the nested for loop, or is there a better approach?
itertools.count()
instead of.count(0)
. :) \$\endgroup\$