3 ms·
I may be missing something... but how is that clearer than for item in report(): for event in item['events']: if event in events_we_care_abou
by ankrgyl 8y ago
I may be missing something... but how is that clearer than
for item in report():
for event in item['events']:
if event in events_we_care_about:
act_upon(event)
break
- jacob019 8y agoIt's a trivial example. Just to demonstrate how for else helps to control an outer loop from within an inner loop.
- rahimnathwani 8y agoYour act_upon is passed values from the inner loop. GP's act_upon is passed values from the outer loop.