On 6/14/05, BJörn Lindqvist <[EMAIL PROTECTED]> wrote: > Oh. I had the impression that the reason do-while's (or do-until's > which I like more) wasn't implemented in the language was because it > was impossible to find an acceptable looking syntax.
No, just because it's fairly redundant. > > > Yes, but grepping the stdlib produces over 300 hits for "while 1:" and > > > "while True:" combined. Some of those a "if <cond>: break" in the > > > middle and some would be better written as generators, but lots of > > > them would be rewritten as do-while's. So I think there is more than > > > enough use cases for syntactic sugar for do-while loops. > > > > The PEP 315 solution looks much better than an "until" that isn't what > > it looks like. > > What do you mean by that? The proposed until would work exactly like > it do in languages that support until loops. I'm also reasonably happy > with PEP 315, except that it seems to force you to end it with a pass > if the condition is last in the loop. But is discussing do-while's > beating a dead horse or is there a possibility that do-while's will > someday make it into the language? You are proposing 'until' that is indented. That is unlike any other language. Translating this to curly-braces style, you're proposing this: do { ...body... until (x <= 0); } I find this bizarre, not " exactly like it do [sic] in languages that support until loops." -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com