[Python-ideas] SyntaxWarning for for/while/else without break or return?

Gerald Britton gerald.britton at gmail.com
Thu Oct 8 18:32:11 CEST 2009

In all my use cases, the else serves the purpose of keeping the code
in a logical group.  For me at least, it is a structural aid.  I vote
strongly against any change that would flag for/while loops with else
clauses but no breaks, especially since there are at least two other
ways for early exit.

On Thu, Oct 8, 2009 at 12:19 PM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> Masklinn writes:
>  > Both would, because in both cases the `else:` clause serves no purpose
>  > whatsoever. It's noise.
> Tut, tut.  In Nick's proposal, both would raise because there is an
> "else:" but there is no break.  I doubt the Python compiler would add
> the editorial comment about "noise," though.<wink>

Gerald Britton

More information about the Python-ideas mailing list