do ... while loop
Martin Pool
martinp at mincom.com
Tue Oct 19 01:00:33 EDT 1999
Cliff Crawford wrote:
> I always liked BEGIN...WHILE...REPEAT in Forth. I guess the Python version
> would look like:
>
> begin:
> x=f.readline()
> while x:
> print x
>
> The point being, you check the condition in the middle of the loop, instead
> of at the beginning or the end.
At least the structure of
while 1:
x = f.readline()
if not x: break
print x
is the same. So it's really just a matter of whether we want a larger,
more specific syntax, or a smaller syntax that relies a little more on
people using idioms.
--
Martin
"Don't confuse excellence, which is achievable, with perfection, which
is elusive." -- Anon
More information about the Python-list
mailing list