do ... while loop

Cliff Crawford cjc26 at nospam.cornell.edu
Sun Oct 17 22:41:27 EDT 1999


Pada Sat, 16 Oct 1999 06:19:29 -0400, Tim Peters bilang:
| > Also, Mr. Niksic is right to posit that a "while 1 ..." looks
| > suspicious to newcomers.
| 
| I agree -- heck, it still looks suspicious to me!  "while 1" is not a good
| thing; but all in all it is a minor thing.

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.

waiting-for-the-keyword-police-to-drag-him-away-ly yr's, Cliff


-- 
cliff crawford   http://www.people.cornell.edu/pages/cjc26/
            There are more stars in the sky than there are
-><-        grains of sand on all the beaches of the world.




More information about the Python-list mailing list