Mention else-clauses; the else-clause on the translation of the

for-loop was broken, and the break-statement probabyl shouldn't have
one.
This commit is contained in:
Guido van Rossum 2005-04-29 17:13:08 +00:00
parent 5ae9e6d5e8
commit 885ebd643c
1 changed files with 13 additions and 7 deletions

View File

@ -150,8 +150,6 @@ Specification: the 'for' Loop
for VAR1 in EXPR1:
BLOCK1
else:
BLOCK2
will be translated as follows:
@ -164,14 +162,16 @@ Specification: the 'for' Loop
break
arg = None
BLOCK1
else:
BLOCK2
(However, 'itr' and 'arg' are hidden from the user, their scope
ends when the while-loop is exited, and they are not shared with
nested or outer for-loops, and the user cannot override the
built-ins referenced.)
I'm leaving the translation of an else-clause up to the reader;
note that you can't simply affix the else-clause to the while-loop
since it is always broken out.
Specification: the Extended 'continue' Statement
In the translation of the for-loop, inside BLOCK1, the new syntax
@ -286,6 +286,12 @@ Specification: the Anonymous Block Statement
the limitations of all finalization semantics) that the block will
be resumed eventually.
I haven't decided yet whether the block-statement should also
allow an optional else-clause, like the for-loop. I think it
would be confusing, and emphasize the "loopiness" of the
block-statement, while I want to emphasize its *difference* from a
for-loop.
Specification: Generator Exception Handling
Generators will implement the new __next__() method API, as well
@ -618,9 +624,9 @@ Acknowledgements
Lundh, Greg Ewing, Holger Krekel, Jason Diamond, Jim Jewett,
Josiah Carlson, Ka-Ping Yee, Michael Chermside, Michael Hudson,
Neil Schemenauer, Nick Coghlan, Paul Moore, Phillip Eby, Raymond
Hettinger, Samuele Pedroni, Shannon Behrens, Steven Bethard, Terry
Reedy, Tim Delaney, Aahz, and others. Thanks all for the valuable
discussion and ideas!
Hettinger, Samuele Pedroni, Shannon Behrens, Skip Montanaro,
Steven Bethard, Terry Reedy, Tim Delaney, Aahz, and others.
Thanks all for the valuable contributions!
References