How can I reset a loop that iterates over a set? A common answer for iterating over a list is to reset the index you are using to access the list, however sets do not support indices.
The point is to be able to iterate over a large set of objects, perform some action against each element until a result matches the result I require. The functionality I am searching for is the ability to reset a loop. Meaning restart the iteration from the beginning to ensure I visit every element again for whatever reason.
How can I reset the following loop?
for element in some_set:print elementif element + offset == needed_result:# reset
I'm using python 2.7 for this specific problem, but I'd also welcome python 3 solutions.