No Do while/repeat until looping construct in python?

lynx none at of.your.business
Fri Mar 14 00:09:20 EST 2003


On Thu, 13 Mar 2003 08:20:15 +0000, Alex Martelli wrote:

[...]
> Yes.  Having a single loop construct as Knuth suggested many decades
> ago, e.g.:

>     repeat:
>         <pre-code>
>     while <test>:
>         <post-code>

> might be nicer syntax sugar than the current Python approach:

>     while True:
>         <pre-code>
>         if not <test>: break
>         <post-code>

> but the syntax-sugar difference is small enough to make it no
> big deal, anyway.

i forget what language i was programming in at the time - i think it was
turbo pascal, i remember struggling with the very most basic ideas of
programming at the time - when it first occurred to me that precondition-
looping and postcondition-looping were trivially equivalent, you just
needed to do a bit of logical massaging of the conditional.

yes, i know, that seems like it should be obvious, but give me some leeway
- i was in my early teens, and such discoveries were major epiphanies to
me at the time. "while x<10" == "until x>=10", hey, i had to learn boolean
logic *some* way or other...

i do not think i've used a postcondition loop since shortly after that
time, however. nor do i think i ever felt so acutely aware of something or
other being "syntactic sugar" since that time, not until just a couple of
years ago, when i learned perl has a "{ something } unless (condition)"
form. *that* seemed really neat, for all of three scripts, when it hit me
there's no _point_ to it.

syntactic sugar _does_ cause cancer of the semicolon. or would, if we ever
had to use semicolons in python. ;-)

-- 
   PGP/GnuPG key (ID 1024D/3AC87BD1) available from keyservers everywhere
    Key fingerprint = FA8D 5EA4 E7DC 84B3 64BC  410C 7AEE 54CD 3AC8 7BD1
                "...if you can fill the unforgiving minute
                with sixty seconds' worth of distance run..."





More information about the Python-list mailing list