This might not be possible but if it is, I want to know how can it be done?
Here is my code-structure
for item in somelist:
# Calcuating some stuff
inside my for loop, I have some evaluation to do which might cause exception.
and even if I handle the exception, current iteration is passed as in complete
What I want to do is, if I get exception, I want to re-evaluate current iteration with some new information.
Is it possible?
Example
for item in somelist:
try:
# calculating item
except Exception:
# re-running current iteration (not from the beginning)
forloop uses the iterator protocol, which means the only thing it can do (after usingiter(somelist)to get the iterator in the first place) is callnexton that iterator.forloop which doesn't exit until you are finally done withitemand ready to get the next value.