[Python-ideas] for/else syntax

Ron Adam rrr at ronadam.com
Sat Oct 3 16:26:18 CEST 2009



Nick Coghlan wrote:
> Nick Coghlan wrote:


> For a loop with no break statements the else clause will *always* be
> executed, hence using the clause is completely redundant - the code it
> contains might as well be dedented and placed inline at the same level
> as the loop header.

The loop could have a "return", "raise", or be inside a "try/except" 
instead of having a "break".

Cheers,
    Ron




More information about the Python-ideas mailing list