AFAIK, this is the pythonic way to ripple breaks up through multiple loops in python. It works in the scenario where we're trying to prove something, not to negate something, I think.
my_data = {'a': (1, 2, 3), 'b': (4, 5, 6), 'c': (7, 8, 9)}
for key, vals in my_data.items():
for val in vals:
if some_condition(val):
break
else:
continue
break
print "found", val, "at", key, "!"
No comments:
Post a Comment