The rap against "while True:" loops

Tim Rowe digitig at gmail.com
Wed Oct 14 11:43:35 EDT 2009


2009/10/14 Marco Mariani <marco at sferacarta.com>:
> Dennis Lee Bieber wrote:
>
>>        One thing to note is that "break" ONLY exits the innermost loop --
>> Ada adds the confusion that one could define a label on the loops, and
>> have the innermost use
>>        exit outer_label [when condition]
>>
>>
>>        THAT I find scary... Since you have to match the label name to
>> something that occurs somewhere prior to the "exit", and THEN have to
>> find the end of that loop.
>
> But we have exceptions.

So has Ada.

> And I know somebody, in other languages, thinks it's
> a Best Practice to avoid using exceptions for flow control.
>
> Thankfully, python programmers are less dogmatic, and use whatever makes
> sense to use. I hope.

Absolutely. And it doesn't make sense to use exceptions for flow control :-)

-- 
Tim Rowe



More information about the Python-list mailing list