How can you continue
the parent loop of say two nested loops in Python?
for a in b:
for c in d:
for e in f:
if somecondi
Here's a bunch of hacky ways to do it:
Create a local function
for a in b:
def doWork():
for c in d:
for e in f:
if somecondition:
return #
doWork()
A better option would be to move doWork somewhere else and pass its state as arguments.
Use an exception
class StopLookingForThings(Exception): pass
for a in b:
try:
for c in d:
for e in f:
if somecondition:
raise StopLookingForThings()
except StopLookingForThings:
pass