[Python-ideas] Updating PEP 315: do-while loops

Stephen J. Turnbull stephen at xemacs.org
Mon Apr 27 06:58:39 CEST 2009

spir writes:
 > Le Mon, 27 Apr 2009 01:36:29 +0900,
 > "Stephen J. Turnbull" <stephen at xemacs.org> s'exprima ainsi:
 > I do not understand the resistance against the "footer" options,

I have no objection to "footer options", unless they involve new
syntax.  We already have

    while True:
        # suite
        if condition: continue

and none of the proposals for footers improve readability over that,

The argument that a do-while with the terminal condition at the head
is a new structure and has some possible advantages in readability is
correct; that's all I had to say.  Let me now add "but it's weak,
IMO."  So I'm with Larry; we don't need this PEP.  There may be some
way to do it, but the current suggestions aren't attractive enough.

Your suggestion of "until <condition>:" may be the best of the lot,
but it's ambiguous for the same reasons "do ... while <condition>:"
is.  Many people will read that as "while not <condition>:".

More information about the Python-ideas mailing list