do...until wisdom needed...

Andrew Dalke dalke at acm.org
Mon Apr 16 03:41:26 EDT 2001


Ken Peek wrote:
>Thank you for the history lesson.  My question still stands--  I
>don't care if it will be implemented or not.  I am looking for
>what would be the correct "Pythonic" construct if it WERE implemented...

>"Terry Reedy" <tjreedy at udel.edu> wrote:
>> This has been discussed ad nauseum for years with no agreement.  If and
>> when maillist or newsgroup archives are available, you can review at your
>> leisure.

But that's Terry's point.  No one has decided on a "Pythonic"
construct, and there have been arguments on that topic.  Nor
did he mention anything about implementation.

I just did a www.python.org/search for "do while until".  The
first hit was to:
http://groups.google.com/groups?q=do+while+until&hl=en&lr=&group=comp.lang.p
ython.*&safe=off&rnum=1&seld=943960637&ic=1
and since I don't know if that link will really work, the thread
is named "why no "do : until"? and took place last December.
(There are older threads, but not indexed by Google.)

The consensus seems to be that there is no Pythonic syntax for
a do/until construct.  It boils down to indentation.  Both your
suggestions were proposed and it was decided that they didn't
make sufficient sense:

  do:
    spam
    until cond

was found to be nothing more than an alias for

  while 1:
    spam
    if not cond: break

and not worth introducing new syntax.

The other proposal is:

  do:
    spam
  until cond

but this "does not fit a pythonic pattern for statements"
(Martijn Faassen).  Reread the full thread for details.

So why didn't you believe that this exact history you were
looking for already existed in the easily searchable archives,
even after Terry pointed it out?

                    Andrew
                    dalke at acm.org










More information about the Python-list mailing list