do...until wisdom needed...
Sheila King
sheila at spamcop.net
Mon Apr 16 23:00:09 EDT 2001
On Mon, 16 Apr 2001 22:43:10 -0400, "Andrew Henshaw"
<andrew_dot_henshaw_at_earthling_dot_net> wrote in comp.lang.python in article
<tdnbgap8tkpce6 at corp.supernews.com>:
:However, I have advocated that 'do' as an
:alias for 'while 1', would be cleaner, more elegant, and simpler to grasp
:for new programmers (e.g., children).
:
:Therefore, in a half-attempt to answer your question, I believe that most
:Pythonic implementation of do-until would be:
:
:do:
: some code
: if condition:
: break
But, as already mentioned in this thread, the word "do" doesn't necessarily
imply looping.
Wouldn't this be even more preferable?
loop:
some code
if condition:
break
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/
More information about the Python-list
mailing list