[Python-ideas] if condition: break idiom
jim_hill_au-24 at yahoo.com.au
Fri Sep 26 11:03:10 CEST 2008
Josiah Carlson wrote:
> On Thu, Sep 25, 2008 at 6:34 AM, Andrew Clover <and-dev at doxdesk.com> wrote:
>> Arnaud Delobelle wrote:
>> I think mid-test/multi-test loops are common enough that it might be worth
>> explicit syntax to pick out the loop exit points:
>> while True:
>> do something
>> andwhile not condition:
>> do something else
> That breaks the flow of the loop, and it is not visually clear that
> "do something else" is a part of the while loop.
do something else
do some other thing
I don't know if you can start a key word with *
but it does pick out the loop exit points
without complicating the indentation.
Is it terribly bad?
It was rejected a few months ago, but possibly
because it was lumped in with some other stuff.
The only alternative I can think of is syntax colouring:
recommend that keywords that break the flow
should be treated differently from other keywords
in Python code editors.
eg break, continue, return, exit in bold red.
More information about the Python-ideas