On Sun, May 01, 2005, Nick Coghlan wrote: > > Option 0: > No else clause allowed. Figured I should mention this, since it is > Guido's last reported inclination, and my total lack of use cases for the > other options below suggests this is the best idea for an initial > implementation.
+1 > 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) +0 > Option 2: mimic if semantics > An 'else' clause on a block statement behaves vaguely like the else > clause on an if statement - the clause is executed only if the first suite > is never entered, but no exception occurs (i.e. StopIteration is raised by > the first call to next). -0 > Option 3: iterator-controlled semantics > The iterator is given the ability to control whether or not the else > clause is executed (e.g. via an attribute of StopIteration), probably using > option 1 above as the default behaviour. -1 Did you deliberately sort the options this way? ;-) I'm mainly responding to deliver my vote against option 3; I don't care much about the other possibilities. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "It's 106 miles to Chicago. We have a full tank of gas, a half-pack of cigarettes, it's dark, and we're wearing sunglasses." "Hit it." _______________________________________________ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
