PEP-315 ("do" loop)

Andrew Koenig ark at
Wed Feb 18 06:18:50 CET 2004

> Most other languages have a way to put the test at the bottom of the loop.
> Pythonically that could look like:
>     repeat:
>        line = sys.stdin.readline()
>     until: line == '\n'
> That would have similar indentation characteristics to try...finally.

I believe it would be more useful to allow the test to be anywhere in the
loop, not just at the beginning or at the end.  Even better would be to
allow more than one test.

More information about the Python-list mailing list