Simple if-else question

Carl Banks pavlovevidence at
Wed Sep 30 17:11:47 CEST 2009

On Sep 30, 3:40 am, Iain King <iaink... at> wrote:
> Read the suggestion again - it's not a warning on the for-else
> structure, it's a warning when the for-else doesn't contain a break;
> he's theorising that a for-else without a break will always trigger
> the else, in which case it's almost certainly an error, and having the
> warning is not a bad idea.

I actually had minor moment of confusion, somehow I was thinking that
if no break appeared in the for-block then the else-block would be
impossible to execute (the opposite of what actually happens).  Even
then just kind of throwing the idea out there, wasn't really
advocating it.

Now that I am no longer confused I definitely don't think there should
be a warning.

Carl Banks

More information about the Python-list mailing list