I post this question since all existing answers solve this issue in one dimension using islice, which is not the same (at least I couldn't figure out how to transfer current solutions to three dimensions).
Suppose we have the following script that produces all discrete combinations of integers for three dimensions ranging from (1 to 127):
for j, k, l in itertools.combinations(range(1, 128), 3):
result = calculations([128, i, j, k, 0])
writeFile(result+"\n")
and suppose that the script gets interrupted at a random (recorded) point, e.g. [128, 121, 98, 45]
. How can we use islice (or any other library) to continue with next iteration, i.e. [128, 121, 98, 46]
and onwards until [128,127,126,125]
?
Thank you for your time,