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

spir denis.spir at free.fr
Mon Apr 27 12:19:10 CEST 2009

[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)
* The issues with '...' is that (1) it obfuscates the code (2) there is no link between the sense of ellipsis itself and the proposed semantics (*)


(*) It would be better used in ranges (python ':') or as line-continuation code (python '\').
la vita e estrany

More information about the Python-ideas mailing list