Pick-up responsibility for PEP 315 (per agreement with Isaac Carroll).
Correct the semantics for continue statements found in the do suite. The previous semantics did not match that for do-while statements in other languages.
This commit is contained in:
parent
b8b57cff0e
commit
f673294b55
|
@ -93,7 +93,7 @@ Index by Category
|
|||
S 304 Controlling Generation of Bytecode Files Montanaro
|
||||
S 310 Reliable Acquisition/Release Pairs Hudson, Moore
|
||||
S 314 Metadata for Python Software Packages v1.1 Kuchling
|
||||
S 315 Enhanced While Loop Carroll
|
||||
S 315 Enhanced While Loop Carroll, Hettinger
|
||||
S 319 Python Synchronize/Asynchronize Block Pelletier
|
||||
S 321 Date/Time Parsing and Formatting Kuchling
|
||||
S 323 Copyable Iterators Martelli
|
||||
|
@ -356,7 +356,7 @@ Numerical Index
|
|||
SD 312 Simple Implicit Lambda Suzi, Martelli
|
||||
SR 313 Adding Roman Numeral Literals to Python Meyer
|
||||
S 314 Metadata for Python Software Packages v1.1 Kuchling
|
||||
S 315 Enhanced While Loop Carroll
|
||||
S 315 Enhanced While Loop Carroll, Hettinger
|
||||
SD 316 Programming by Contract for Python Way
|
||||
SR 317 Eliminate Implicit Exception Instantiation Taschuk
|
||||
SF 318 Decorators for Functions and Methods Smith, et al
|
||||
|
|
20
pep-0315.txt
20
pep-0315.txt
|
@ -2,12 +2,13 @@ PEP: 315
|
|||
Title: Enhanced While Loop
|
||||
Version: $Revision$
|
||||
Last-Modified: $Date$
|
||||
Author: W Isaac Carroll <icarroll@pobox.com>
|
||||
Author: W Isaac Carroll <icarroll at pobox.com>
|
||||
Raymond Hettinger <python at rcn.com>
|
||||
Status: Draft
|
||||
Type: Standards Track
|
||||
Content-Type: text/plain
|
||||
Created: 25-Apr-2003
|
||||
Python-Version: 2.4
|
||||
Python-Version: 2.5
|
||||
Post-History:
|
||||
|
||||
|
||||
|
@ -90,11 +91,16 @@ Semantics of break and continue
|
|||
without evaluating the loop condition or executing the else
|
||||
clause.
|
||||
|
||||
A continue statement in the do-while loop will behave somewhat
|
||||
differently than in the standard while loop. Instead of jumping
|
||||
back to the loop condition, it will jump to the beginning of the
|
||||
first suite of the loop. This is to ensure that the setup code
|
||||
has a chance to do its job before the condition is evaluated.
|
||||
A continue statement in the do-while loop jumps to the while
|
||||
condition check.
|
||||
|
||||
In general, when the while suite is empty (a pass statement),
|
||||
the do-while loop and break and continue statements should match
|
||||
the semantics of do-while in other languages.
|
||||
|
||||
Likewise, when the do suite is empty, the do-while loop and
|
||||
break and continue statements should match behavior found
|
||||
in regular while loops.
|
||||
|
||||
|
||||
Future Statement
|
||||
|
|
Loading…
Reference in New Issue