PEP 315: Enhanced While Loop

Gareth McCaughan Gareth.McCaughan at pobox.com
Wed May 7 18:25:56 EDT 2003


SUZUKI Hisao wrote:

> And from the mathematical view, "while...else..." is cleanly
> defined.  Let W be "while e: s else: t".
> Then W is the least fixed point of the equation:
>    W = if e:
>          s; W
>        else:
>          t
> 
> Imho, both constructs of W. I. Carroll and A. Koenig lack
> such simplicity.

    while C1:
      S1
    and while C2:
      S2
    else:
      E

is the least fixed point of

    W1  ==  if C1: { S1; W2 }
            else:  E
    W2  ==  if C2: { S2; W1 }
            else:  E

But I'm not sure why this is important, since (1) neither
of these deals with "break" and "continue" and (2) maybe
0.001% of Python programmers think of their programs as
built out of least fixed points of sets of equations.

-- 
Gareth McCaughan  Gareth.McCaughan at pobox.com
.sig under construc




More information about the Python-list mailing list