Another question could be: why is there not a statement "whileTrue" or "loop"?

For exemple:

whileTrue:
    statement 1
    if condition:
        break
    statement 2


It could be an economy of one unuseful test by loop.

On 6/21/05, Magnus Lycka <[EMAIL PROTECTED]> wrote:
Remi Villatel wrote:
> while True:
>     some(code)
>     if final_condition is True:
>         break
>     #
> #
>
> 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:
     some(code)
--
http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to