Is this PEP-able? fwhile

Chris Angelico rosuav at gmail.com
Mon Jun 24 17:38:57 EDT 2013


On Tue, Jun 25, 2013 at 5:52 AM,  <jimjhb at aol.com> wrote:
> (NOTE:  Many people are being taught to avoid 'break' and 'continue' at all
> costs...

Why? Why on earth should break/continue be avoided? I think that's the
solution: teach people that loops are there to be interrupted and
manipulated. And then it's a small step to jumping into the middle of
a loop, and from there to Duff's Device... hmm, I'm not sure that
strengthens my case, really. But anyway. Python has no issues with
breaking out of loops, and even has syntax specifically to complement
it (the 'else:' clause). Use break/continue when appropriate.

ChrisA



More information about the Python-list mailing list