[Python-ideas] loop, breakif, skip

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Sep 9 10:21:06 CEST 2007

Jim Hill wrote:
> Think of non-programmers writing simple scripts,
> and children learning basic coding in grade school.
> Abolish 'continue' in loops, and use 'skip' instead.

I wouldn't recommend teaching beginning programmers
about continue at all, whatever it's called. It's
an unneccessary complication when learning the

> 'loop:' is exactly equivalent to 'while True:'

> '*breakif <condition>'
> '*skipif <condition>'

These just look ugly and unpythonic.

> the keyword 'loop' can be placed in front of the keyword 'while'
> the keyword 'loop' can be placed in front of the keyword 'for'

'Loop' is a piece of programming jargon, not
something that would occur readily to someone thinking
in everyday terms. Python's way of phrasing its
loops is closer to natural English, therefore,
one would expect, easier for beginning programmers
to get the meaning of.

> Allows beginner students the satisfaction of thinking that
> every kind of loop begins with the word 'loop',

All two of them? I don't think that's a big enough
burden on the memory to be worth introducing
Another Way To Do It.

> 'continue' in a Python switch block would have a meaning
> opposite to that of 'break' in a C switch block,
> allowing you to do 'fall-through'.

I don't think that's any more intuitive than its
current meaning. The word 'continue' on its own
doesn't really say anything at all about *what*
to continue with, except in a context where you're
stopped in some way, which is not the case here.
So whatever meaning is chosen, it's something
that has to be learned.


More information about the Python-ideas mailing list