Breaking/continuing out of multiple loops

I actually kind of agree with that. For example the top result when I search “python multiple for loop break” is:

The first response has no example, so is maybe easily ignored, the second response has a clever solution, but maybe “too clever”? Applied to the original example above it would look like this I guess:

for sport in all_sports:
	for player in all_players:
		for player_tables in all_tables:
			for version in player_tables:
				# things have gone wrong, go to next iteration of all_sports loop
				break
			else:
				continue
			break
		else:
			continue
		break

:face_with_spiral_eyes:

3 Likes