On 21Jan2009 14:02, Tres Seaver <tsea...@palladion.com> wrote:
| Vitor Bosshard wrote:
| > BTW, there is already an "until" keyword in python, it's called "while not" 
;)
| 
| 'until' is used at least in some languages (Pascal, Modula*, maybe Ada?)
| for a "terminate at bottom" loop (one guaranteed to run at least once):
|  in such cases, the predicate has the negative sense.

This is a particular flavour of "do ... while" which just happens
to read a little better in English. It does sometimes bother me that
Python doesn't have do...while when I find my self replicating the loop
bottom above the loop.

Back at uni we had to implement a small language in our compilers class
and the lecturer had specified a proper generic while loop, thus:

  loop:
    suite
  while invariant
    suite
  endloop

I think the keywords were better than above, but it neatly handled the
fact that the while-test must often be preceeded by some setup that
would be replicated at the loop bottom in Python and many other languages:

  setup-invariant-state
  while test-invariant
    do stuff
    setup-invariant-state

of which the bare while... and converse do...while loops are particular
extremes.

Cheers,
-- 
Cameron Simpson <c...@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Why doesn't DOS ever say EXCELLENT command or filename?
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to