why no "do : until"?
Tim Peters
tim.one at home.com
Sun Dec 31 06:04:01 EST 2000
To summarize 10 years of fruitless discussion on this issue: yes,
while 1:
...
if finished:
break
is the intended way to spell "do ... until" in Python.
"do ... until F" is better than "do ... while F" because the truth of F
conjoined with the loop invariant and loop precondition should imply the
loop postcondition, and the "while" form artificially negates the F of
interest, thus making reasoning harder.
"do ... while F" is better than "do ... until F" because the truth of F
conjoined with the loop invariant and loop precondition should imply that
the loop invariant still holds, and the "until" form artificially negates
the F of interest, thus making reasoning harder.
Python's indentation rules do indeed not fit well with either form. If
there were an obvious way to make them fit well, Guido would have done so a
long time ago. In the meantime, if you think you see one, write a PEP!
and-no-of-course-uninitialized-vrbls-exist-in-python-ly y'rs - tim
More information about the Python-list
mailing list