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

Yuvgoog Greenle ubershmekel at gmail.com
Fri Oct 9 06:58:03 CEST 2009

On Fri, Oct 9, 2009 at 6:09 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> 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.

So the compiler shouldn't guess you were wrong when you wrote a
"break" not in a loop? Please do remember we prefer no silly
limitations as much as we are against silly mistakes.

And btw, concerning your "__debug__" example: that code won't raise a
warning because the "__debug__: break" will pass the parsing stage and
be optimized out in the code generation stage, so don't worry, it's
taken care of.


More information about the Python-ideas mailing list