From f673294b556fdf718063269a0ecd37c9e9549cc3 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sat, 18 Jun 2005 06:21:36 +0000 Subject: [PATCH] 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. --- pep-0000.txt | 4 ++-- pep-0315.txt | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/pep-0000.txt b/pep-0000.txt index 2e7f4bc30..3aaeeaab6 100644 --- a/pep-0000.txt +++ b/pep-0000.txt @@ -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 diff --git a/pep-0315.txt b/pep-0315.txt index 3ffab913f..b91441c35 100644 --- a/pep-0315.txt +++ b/pep-0315.txt @@ -2,12 +2,13 @@ PEP: 315 Title: Enhanced While Loop Version: $Revision$ Last-Modified: $Date$ -Author: W Isaac Carroll +Author: W Isaac Carroll + Raymond Hettinger 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