[Python-Dev] re: LANL syntax feedback (loops)

gvwilson@nevex.com gvwilson@nevex.com
Thu, 3 Feb 2000 18:58:43 -0500 (EST)


> > Greg Wilson wrote:
> >         while:
> >             first-half
> >         and while condition-1:
> >             second-half
> >         and while condition-2:
> >             third-half # [sic]
> >         and while final-condition # no trailing ':'

> Ka-Ping wrote:
> This *is* confusing.  Does the "third-half" get executed if
> condition-2 is true, or only if condition-1 and condition-2 are both
> true?

The loop breaks out the first time it finds a false condition.  I find it
confusing as well, and wonder whether the extra generality would ever be
used.  I'd even want to put:

do:
    first-half
while cond:
    second-half

in front of both novices and experts --- is this two loops, or one?

> "do" doesn't even have to be made into a keyword for the do...while
> construct to work: there is no other valid construct in which a name
> would appear followed by a colon as the first thing in a statement or
> expression, so the parser should be able to figure it out.

Might not be true in future, so probably dangerous to assume now.  (Icon,
anyone? :-)

Thanks,
Greg