why no "do : until"?

Rainer Deyke root at rainerdeyke.com
Sat Dec 30 12:17:22 EST 2000


"Steve Lamb" <grey at despair.rpglink.com> wrote in message
news:slrn94qt4f.mgg.grey at teleute.rpglink.com...
> On Sat, 30 Dec 2000 05:23:26 GMT, Rainer Deyke <root at rainerdeyke.com>
wrote:
> >At that point it's better to use 'while 1', which is at least idiomatic
and
> >explicit in its inelegance.
>
>     I'm sorry, but I don't agree.  Even though I have no problem with
while 1:
> initing variables before the loop is more preferable to a break.  Esp.
when
> one can put the condition in the while; unlike reading lines from a file
where
> one cannot.

The example was something like this:

T = 0
while T < 25:
  T = ...

to simulate somethjing like this:

do:
  T = ...
until t >= 25

In other words, you need to artifically manipulate the 'while' condition to
always be true the first time through.  If you change the 'while' condition,
you may have to change the manipulation.  In other words, there's an
additional way the code could break.


--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list