[Python-Dev] PEP 340: Else clause for block statements

Greg Ewing greg.ewing at canterbury.ac.nz
Mon May 2 05:02:03 CEST 2005


Nick Coghlan wrote:

> Option 1: mimic try, for, while semantics
>    An 'else' clause on a block statement behaves like the else clause on 
> for and while loops, and on try/except statements - the clause is 
> executed only if the managed suite completes 'normally' (i.e. it is not 
> terminated early due to an exception, a break statement or a return 
> statement)

I've always thought that was a particularly unintuitive use
of the word 'else', and I'm not sure I'd like it to be
extended to any new statements.

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+


More information about the Python-Dev mailing list