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

Masklinn masklinn at masklinn.net
Thu Oct 8 22:31:22 CEST 2009

On 8 Oct 2009, at 21:44 , Terry Reedy wrote:
> You and the OP would force ME to also comment out or delete the  
> 'else:' and dedent 'do_b' for no functional reason but merely to  
> satisy YOUR esthetic style preference.
That is not the case, and that's the difference between an *error* and  
a *warning*.

A warning doesn't *force* anything, it merely… warns. If you want to  
ignore the warning, you're free to do so. Most of the time, there's  
even a switch to disable (or enable, if it's not enabled by default)  
the aforementioned warning.

The point of a warning is very much that the code works and is legal,  
but *in most case* is not what people would want. If it's what you  
want, you're free to go ahead and keep the code as is, ignoring the  
warning (or even filtering it out).

More information about the Python-ideas mailing list