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

alex23 wuwei23 at gmail.com
Fri Oct 9 03:58:50 CEST 2009


Masklinn <maskl... at masklinn.net> wrote:
> 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).

You could make the same case for issuing a warning every time someone
uses a mutable object as a default value in a function definition.
This has _certainly_ caused a lot more confusion than the loop-else
construct. But recourse to naive realism isn't a valid argument here;
you're in effect punishing those who have taken their time to
familiarise themselves with the language to spare those who haven't
from ever having to do so.

The effort should be in _learning_ the language, not in continually
bypassing the training wheels.



More information about the Python-ideas mailing list