Errors have resumable error codes
I was told how to get the Nth product on Stackoverflow, he also told me how to get the product number from a product! Which you must understand how useful that is. Error messages can be completely retried and resumed with this information. I only need to log or print out a special error code and the user can retry from where they left off!
Assuming you have a nested loop,
for letter in letters:
for number in numbers:
for symbol in symbols:
print(letter + number + symbol)
If the code fails halfway through, you print out ERROR-letter-number-symbol. Then you use the following function to calculate the Nth position in the product list:
def position(list_of_lists, tup):
t = 1
res = 0
for lst, x in zip(reversed(list_of_lists), reversed(tup)):
res += t * lst.index(x)
t *= len(lst)
return res
From this point we can resume the loop!