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

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


On Fri, 9 Oct 2009 03:00:57 pm geremy condra wrote:

> The fact that code is currently legal (or illegal) does not stop us
> from making judgments about whether it should or should not be
> legal- 

Of course. *We* do. The compiler shouldn't. It should shut up and 
compile, not comment on my coding style. That's what PyLint is for.

[...]
> So what? Suppress the warning if you want, otherwise, listen
> to it, it's telling you that your code probably isn't doing what
> you intended it to do.

I reject the position that the compiler should be guessing what I 
intended. The compiler should do what I say, exactly as I say it, and 
not editorialise with spurious warnings about things which aren't 
errors. Again, that's what PyLint is for.


-- 
Steven D'Aprano



More information about the Python-ideas mailing list