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

Chris Rebert pyideas at rebertia.com
Mon Apr 27 12:45:34 CEST 2009

On Mon, Apr 27, 2009 at 3:19 AM, spir <denis.spir at free.fr> wrote:
> [off list -- because it's a side-issue]
> Le Mon, 27 Apr 2009 13:58:39 +0900,
> "Stephen J. Turnbull" <stephen at xemacs.org> s'exprima ainsi:
> Thanks for your comments.
>> Your suggestion of "until <condition>:" may be the best of the lot,
> Certainly not the best for all readers, but the simplest as of now ;-)
>> but it's ambiguous for the same reasons "do ... while <condition>:"
>> is.
> The source of ambiguity and even mislead is that it is placed on top while the condition is evaluated at end of loop. Anyway, it's an exit condition so it fits better down there IMO where ever it may be evaluated.
> The reason why I favor 'footer' options.
>> Many people will read that as "while not <condition>:".
> My opinion about that is the following:
> * A new keyword is enough to force the reader to consider the code with attention and expect something different.
> * Obviously 'until' cannot have the same meaning as 'while' -- rather the opposite in fact. Don't you think so? (english is not my mother tongue)

As someone whose native language is English, I can say that Stephen's
reading would indeed intuitively be considered the obvious logical
opposite of a "while" loop; also, his interpretation matches the
behavior of "until" loops in both Perl and Ruby.


More information about the Python-ideas mailing list