Charles Cazabon <[EMAIL PROTECTED]> wrote: > Indeed. The original poster seems to want something that would work (not > necessarily look) like this: > > do: > <block> > while <condition> > > with <block> executed once prior to <condition> first being tested. But the > above is ugly, and you can get much the same effect with Python today: > > firsttime = True > while firsttime or <condition>: > <block> > firsttime = False > > Seems fairly Pythonic to me. YMMV.
I agree. It also handles 'else' clauses very well. Heck, even Michael McLay's offering of ... while True: <body-1-or-more-times> if <condition>: <on-natural-loop-exit> break <body-0-or-more-times> ... doesn't look too bad, and supports the full range of pre and post condition code. Just like the indented "until", it may not be obvious where the breaking condition lies. However, a syntax highlighting editor and a properly located comment or two would solve the problem with "until" and the breaking "if" above. I'm of the opinion that the "do while" and "loop and a half" variants of the while loop should be offered as a recipe somewhere in the documentation. Perhaps not directly in the tutorial (maybe a link), describing quickly how you can use while loops to emulate the full spectrum of looping constructs. - Josiah _______________________________________________ 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