PEP 315: Enhanced While Loop

Erik Max Francis max at alcyone.com
Tue May 6 15:39:56 EDT 2003


W Isaac Carroll wrote:

> PEP: 315
> Title: Enhanced While Loop
> Version: $Revision: 1.1 $
> Last-Modified: $Date: 2003/05/02 22:53:32 $
> Author: W Isaac Carroll <icarroll at pobox.com>
> Status: Draft
> Type: Standards Track
> Content-Type: text/plain
> Created: 25-Apr-2003
> Python-Version: 2.4
> Post-History:
> 
> Abstract
> 
>      This PEP proposes adding an optional "do" clause to the beginning
>      of the while loop to make loop code clearer and reduce errors
>      caused by code duplication.

Lukewarm.  The while True: ... if condition: break ... is so widespread
and understandable that I don't see any huge benefit from the
introduction of a new construct for handling it, but at the same time
wouldn't be strongly opposed to one being added to the language.

The other variants which involve a

	KEYWORD condition:
	    statements

where it's just "understood" that the statements will be executed once
regardless seems like a very bad precedent, since it's quite nonobvious
that that's the case, and I can't imagine a reasonable keyword used
there that would flag that behavior in an intuitive way.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ To be adult is to be alone.
\__/ Jean Rostand
    CatCam / http://www.catcam.com/
 What do your pets do all day while you're at work?  Find out.




More information about the Python-list mailing list