[Python-ideas] for/except/else syntax

Adam Atlas adam at atlas.st
Fri Oct 9 04:02:03 CEST 2009

On 8 Oct 2009, at 02:29, Stephen J. Turnbull wrote:

> Adam Atlas writes:
>> On 7 Oct 2009, at 11:17, Andrey Fedorov wrote:
>>> Agree with Rob that the "else" keyword confusing in the context of a
>>> for loop. In my mind, "for each pebble in the bag, give it to Ben,
>>> or else ..." has no clear semantic meaning. What do you mean, "or
>>> else"?
>> That wouldn't have any particular meaning in Python either (in that
>> the "else" clause would never execute).
> No, the else clause (as currently defined) *always* executes.

Whoops, got it backwards. And I thought I had gotten used to its  
meaning. :P
(I swear I usually remember what it means!)

More information about the Python-ideas mailing list