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

Nick Coghlan ncoghlan at gmail.com
Sat Oct 10 13:45:46 CEST 2009

Steven D'Aprano wrote:
> This extra information is missing in the second case, where there is 
> nothing suggesting that suite belongs with the for-loop: they look 
> independent. To learn that they're not, you have to read the code in 
> enough detail to understand it fully.

I can see your point, but the confusion with the naive "if seq is
contains at least 1 element do the loop, else do the else clause"
outweighs it in my mind.

That may have something to do with my personal preference for using
vertical whitespace and comment lines to obtain logical groupings below
the function level.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list