For example, can this code be rewritten without break
(and without continue
or return
)?
import logging
for i, x in en
The break
and continue
keywords only have meaning inside a loop, elsewhere they are an error.
for grooble in spastic():
if hasattr(grooble, '_done_'):
# no need for futher processing of this element
continue
elif grooble is TheWinner:
# we have a winner! we're done!
break
else:
# process this grooble's moves
...
Anyone who says break
and continue
should not be used is not teaching good Python.