do ... while loop

John W. Stevens jstevens at basho.fc.hp.com
Thu Oct 21 14:54:18 EDT 1999


Martin Pool wrote:
> 
>   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.

Which is why, if we were discussing a new language, I would suggest
creating
ONLY the

loop:
    <statements>
    break <condition>
    <statements>
    continue <condition>
    <statements>

construct (the condition on both the break and continue is optional). 
No while.
No for.  No do.  Just loop.  After all, it makes a weird kind of sense:
loop
is the super class of while and for, right? ;->

But we're talking about Python, so the best bet would probably be to
just drop this discussion . . . except it is kinda fun!

John S.

============

If I spoke for HP --- there probably wouldn't BE an HP!

John Stevens
john_stevens at fc.hp.com




More information about the Python-list mailing list