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

Steven D'Aprano steve at pearwood.info
Fri Oct 9 05:06:48 CEST 2009


On Fri, 9 Oct 2009 07:31:22 am Masklinn wrote:
> 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.

It forces me to read it.

It forces me to take the time to filter out in my head real warnings for 
real problems, and pretend warnings for non-problems, or to run Python 
with some switch to disable warnings -- which means I lose the ability 
to get real warnings I care about.

Excessive warnings trains me to ignore them. "Oh, it's some stupid 
compiler warning, don't worry about it, it's complaining for no good 
reason".

(Sometimes I think some coders haven't heard of the story of The Boy Who 
Cried Wolf.)


> 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. 

Can you give any examples in the Python standard library where code 
raises a warning on such a basis?

I would be shocked if you can give any examples.




-- 
Steven D'Aprano



More information about the Python-ideas mailing list