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

Gerald Britton gerald.britton at gmail.com
Thu Oct 8 23:03:40 CEST 2009


Based upon Guido's post in this thread, I think the chances of getting
such a warning are between slim and none.  And, I'm very happy about
that.  In fact, I would be extremely unhappy if a program that has
worked for 20 years (Guido's number, not mine) would suddenly start to
spurt warnings just because I upgraded Python.

Bad idea all round.

OTOH, if you really would like such a warning, put it in pylint.
Seems to me to be by far the best option.

On Thu, Oct 8, 2009 at 4:31 PM, Masklinn <masklinn at masklinn.net> wrote:
> 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).
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



-- 
Gerald Britton



More information about the Python-ideas mailing list