Python for
loops can have an else
block, which is executed if those loop is not broken out of:
for thing in things:
...
if (thing == 'something'):
break
else:
... # Do something
This code will work in the same way as yours, but doesn't need a flag. I think this fits your criteria for something a bit more elegant.