Loop until condition is true
cdkrug at worldnet.att.net
Tue Jun 21 15:18:59 CEST 2005
On Tue, 21 Jun 2005 12:05:25 +0200, Magnus Lycka <lycka at carmen.se> wrote:
> Remi Villatel wrote:
>> while True:
>> if final_condition is True:
>> What I don't find so "nice" is to have to build an infinite loop only to
>> break it.
> This is a common Python idiom. I think you will get used to it.
>> Is there a better recipe?
> final_condition = False
> while not final_condition:
To the OP, don't get hung up on the syntax we use to implement a loop.
I took my first programming class long enough ago that we had to do
things like this (roughly translating the FORTRAN IV I remember into
we'd have to write:
if not TrueConditional goto loopEnd
We were even required to write our source twice:
The first pass was "structured" and had to be proven correct.
The second pass was translated into something our compiler supported.
We still called it a "while loop" even though the syntax was icky.
When C came out with its built in looping, it was an unbelievable
More information about the Python-list