PEP-315 ("do" loop)

Andrew Koenig ark at acm.org
Tue Feb 17 14:20:53 EST 2004


> This could be solved by starting with a 'while' construct as normal and
then
> following it with the new keyword:
>
>   while True:
>     setup_condition
>   anwhile condition:
>     loop_body
>
> ('anwhile' is by analogy with 'elif', but anything could be used.)

Hmmm... You could spell it "and while" without needing a new keyword at all.
Moreover, if you were to define "while:" as equivalent to "while True:",
then you could do this:

    while:
        setup_condition
    and while condition:
        loop_body

No reading backwards needed.





More information about the Python-list mailing list