statements in control structures (Re: Conditional Expressions don't solve the problem)

Huaiyu Zhu huaiyu at gauss.almadan.ibm.com
Fri Oct 19 14:45:14 EDT 2001


On Fri, 19 Oct 2001 05:10:08 -0600, Andrew Dalke <dalke at dalkescientific.com>
wrote: 
>Markus Schaber:
>>Maybe this form could be expanded to allow:
>>
>>do
>>  some
>>  statements
>>while cond:
>>  something
>>  else
>
>This post is exactly why this topic needs to be written up
>in a PEP - even if the decision is not to implement it.  This
>same proposal has come up many, many times and I would like to
>say
>
>  "Yep, look at PEP 12345"

This particular structure is the most appealing, except for historical
reasons:  

- presumably multiple "while" parts would be allowed.
- If the "do" part is optional, it would be difficult to locate the start of
  a loop.
- If the "do" part is mandatary, the keyword "while" must be changed - to
  what?

One small problem is whether the while part should be indented or not: It is
more like a "case" statement (with fall through) than an "elif" statement.

>
>Huaiyu Zhu?  Want to finish up your PEP?

I'd love to, but I've already spent more time on this than I could afford.
It would take additional time to summarize all the new points raised.
Anyone can take it over anyway (I haven't even applied for a PEP number
yet).  I'd be glad to send over the fragmented notes I've taken on this
subject.

Are you interested, Andrew?

BTW, Christopher A. Craig got a different statistics by searching "while 1",
which would be similar to what you said before.  My quick search on "break"
is somewhat different.   Anyone care to make a more thourough comparison?


Huaiyu



More information about the Python-list mailing list