Jeffrey Froman jeffrey at
Tue Mar 4 20:22:04 CET 2008

Carl Banks wrote:

> there is a
> rationale behind the name "else".  If you consider a for loop to be a
> rolled-up if...elif...else statement

This is an interesting angle. I've always considered "for/else" to be
unintuitive, not because of "else", but because of the coupling with "for".
Instead, I think of this as a "break/else" statement, and everything gels
for me. The same applies to my comprehension of "while/else".

I wonder how this came to be called "for/else" or "for-else". I haven't
spotted that expression in the python docs yet.

With whatever name, I find the construct quite elegant and regularly useful.


More information about the Python-list mailing list