do ... while loop
Cameron Laird
claird at starbase.neosoft.com
Thu Oct 14 16:14:23 EDT 1999
In article <000201bf1602$9d71f4a0$ba2d153f at tim>,
Tim Peters <tim_one at email.msn.com> wrote:
>[Joshua Marcus, fighting initial lack-of-feature bloat <wink>]
>> ...
>> There are, in fact, other situations in which one actually wants a
>> "do...while" loop & one is forced to either repeat code or make a
>> meaningless initial assignment.
>
>Those are never necessary, although it's amazing how often people fall into
>believing they are. The usual Python idiom for:
.
.
.
It amazes me less than you. Surely you remember
the pedagogic fashion--is it still in bloom?--of
preferring "single-exit" control structures. I
suspect many of the people stumbling around in
this area bear that burden still; they fear some-
one will "take off points" for every break or
continue. Also, Mr. Niksic is right to posit that
a "while 1 ..." looks suspicious to newcomers.
.
.
.
>The criminally insane sometimes write the last line instead as:
>
> if not condition: break
>
>but putting it on separate lines (as God intended) is key to making the
>idiom instantly (after you're used to it -- about two days) recognizable for
>what it is.
"... as G*d* intended ..."
.
.
.
>Has been debated many times. There's no pleasant way to spell it in Python;
>all blocks have opening keywords, but never closing keywords.
I'm thinking about whether that'll help
a LOT in getting the message through.
.
.
.
--
Cameron Laird http://starbase.neosoft.com/~claird/home.html
claird at NeoSoft.com +1 281 996 8546 FAX
More information about the Python-list
mailing list