[Python-ideas] Updating PEP 315: do-while loops
Ben Finney
ben+python at benfinney.id.au
Mon Apr 27 04:40:42 CEST 2009
Stefan Behnel <stefan_ml at behnel.de>
writes:
> Hmm, so why add another keyword like "do", instead of just giving
> "while" a default condition "True", so that you could write
>
> while:
> state = do_stuff_here()
> if predicate(state): break
>
> I think that the missing condition at the top makes it pretty clear
> that the end condition must be inside the loop.
Or that there isn't an end condition at all.
I don't see how this indicator is any less clear than the current
spelling::
while True:
state = do_stuff_here()
if predicate(state): break
--
\ “I would rather be exposed to the inconveniences attending too |
`\ much liberty than those attending too small a degree of it.” |
_o__) —Thomas Jefferson |
Ben Finney
More information about the Python-ideas
mailing list