[Python-Dev] PEP 351 - do while

Michael Urman murman at gmail.com
Sun Oct 1 16:14:14 CEST 2006

On 10/1/06, Ron Adam <rrr at ronadam.com> wrote:
> (I don't think this has been suggested yet.)
>      while <enter_condition>, <exit_condition>:
>         <body>


> Putting both the entry and exit conditions at the top is easier to read.

I agree in principle, but I thought the proposed syntax already has
meaning today (as it turns out, parentheses are required to make a
tuple in a while condition, at least in 2.4 and 2.5). To help stave
off similar confusion I'd rather see a pseudo-keyword added. However
my first candidate "until" seems to apply a negation to the exit

    while True until False:  # run once? run forever?
    while True until True:  # run forever? run once?

It's still very different from any syntactical syntax I can think of
in python. I'm not sure I like the idea.

Michael Urman  http://www.tortall.net/mu/blog

More information about the Python-Dev mailing list