I'm looking for options of shortening syntax for breaking (and continuing) a loop on a condition
for _ in range(10):
if condition:
break
...
I supposed that short curcuits should work, e.g. x == 2 and break
, but they cause SyntaxError
.
What are Python's options for one-line conditioning, except if condition: break
?