PEP 315: Enhanced While Loop

Terry Reedy tjreedy at udel.edu
Mon May 5 19:53:50 EDT 2003


"rzed" <Dick.Zantow at lexisnexis.com> wrote in message news:b96fk8$u2>
I'd still prefer to see an indention of the entire while block,
> though -- it seems more obvious:
>
> while <condition1>:
>     <code1>
>     and if <condition2>:
>         <code2>
>     and if <condition3>:
>         <code3>


As I understand the proposal, this is computationally equivalent to
and only marginally different in form from the currently legal

while <condition1>:
    <code1>
    if <condition2>:
        <code2>
        if <condition3>:
           <code3>
        else: break
    else: break

So the proposals seem to be about changing indentation and making
break implicit instead of explicit.  This is at most an esthetic and
not a functional enhancement.

I am currently thinking that Python's syntax should be 'congealed' -- 
not quite frozen but far from liquid -- and (with at most a few
exceptions) only changed (at least for 2.x series) for reasons other
than the syntax change itself.  Examples are any remaining changes
needed to finish unify ints and longs or types and classes.

Terry J. Reedy






More information about the Python-list mailing list