No Do while/repeat until looping construct in python?

Frank Millman frank at chagford.com
Sun Mar 16 06:37:06 EST 2003


"Greg Ewing (using news.cis.dfn.de)" <me at privacy.net> wrote in message news:<b4rkcq$22tehe$1 at ID-169208.news.dfncis.de>...

[snip]
> 
> And this is *such* a common looping pattern that I really
> don't understand why *no* language I can remember seeing
> has explicit support for it.

For the record, Pick Basic (the language that comes with the Pick
Operating System/Database and its various flavours) has had this since
the mid-1970's :-

loop
    <pre-code>
while/until <condition> do
    <post-code>
repeat

Both pre and post code can be blank. The "do" became optional in later
versions.

I became very comfortable with this syntax (I was a "Pickie" from
1980-2001), but I do not have any problem with the work-arounds that
have been discussed in this thread. I would not vote for adding it to
the language.

While wandering down memory lane, this brings to mind another recent
thread about "case" statements. This is how Pick does it :-

begin case
  case <condition>
    <code>
  case <condition>
    <code>
end case

Again, I enjoyed using this. The condition can be any expression,
simple or complex, that evaluates to true or false. There is a neat
way of handling the default fall-through case - just make your last
test "case 1" - it is always true, so will always be processed.

Do I miss this is Python? No, I am quite happy with if/elif/else.

One last bit of nostalgia, and something that I do miss a bit. I think
the underlying architectures are too different to do anything about
it, and many people will disapprove of it, but here it is anyway.

Pick has something similar to lists, which it calls dynamic arrays. I
will use Python syntax to illustrate what it could do. If you had a
list "x" of three elements, and said "x[5] = 123", Pick would not give
an error, it would automatically extend the list to a length of 6,
making the 4th and 5th elements blank. This made for a very
free-thinking programming style.

I am not trying to start a debate here, so please do not respond to
this. I just wanted to set the historical record straight regarding
the first item.

Frank




More information about the Python-list mailing list