[Python-ideas] SyntaxWarning for for/while/else without break or return?
Jared Grubb
jared.grubb at gmail.com
Thu Oct 8 21:09:19 CEST 2009
On 8 Oct 2009, at 09:32, Gerald Britton wrote:
> 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.
I am also against this. It's a PyLint problem, if anything.
(Just for completeness, I suppose 'yield' is a third way; but like
return/raise, it makes the else unnecessary)
Jared
More information about the Python-ideas
mailing list