[Python-ideas] SyntaxWarning for for/while/else without break or return?
masklinn at masklinn.net
Thu Oct 8 18:24:55 CEST 2009
On 8 Oct 2009, at 18:19 , Stephen J. Turnbull wrote:
> Masklinn writes:
>> Both would, because in both cases the `else:` clause serves no
>> whatsoever. It's noise.
> Tut, tut. In Nick's proposal, both would raise because there is an
> "else:" but there is no break.
Well yeah but that was what I was saying: in both cases (because there
is no break) the `else:` clause has no purpose, the exact same
behavior would be obtained by moving the code inside it to just behind
the `for:` clause and removing the `else:` one. Therefore the "else:"
part of the `else:` clause is noise in the system, it's not signal and
it's not absent.
> I doubt the Python compiler would add
> the editorial comment about "noise," though.<wink>
More information about the Python-ideas