Thoughts on PEP315

Tim Rowe tim at
Tue Sep 23 16:19:12 CEST 2003

On Tue, 23 Sep 2003 04:39:14 +0100, Stephen Horne
<$$$$$$$$$$$$$$$$$@$$$$$$$$$$$$$$$$$$$$> wrote:

>On Mon, 22 Sep 2003 21:47:05 -0400, "John Roth"
><newsgroups at> wrote:

>>    bibbity
>>    bobbity
>>    boo
>>    while condition  # note the lack of a colon!
>This is really no different to the following, which is quoted in the
>PEP as something to move away from...
>  while True :
>    ...
>    if condition : break
>    ...
>The fundamental problem is that the exit point is not obvious because
>it is 'hidden' in the detail of the loop - it is a statement within
>the loop body instead of being lexically a part of the loop.

It is very different indeed.  In the second case stuff can go after
the "if condition: break", so the terminating condition is potentially
buried in the surrounding code.  On my reading of John's proposal
nothing can go after the "while condition", so the end is clearly
marked in the Python way by the indentation dropping back a level.

What I /don't/ like about it is the overloading of the "while"
keyword.  I would much sooner reverse the condition and use "until",
though I realise the back-compatibility issues of introducing new

More information about the Python-list mailing list