PEP-0315--Enhanced While Loop: An idea for an alternative syntax

Erik Max Francis max at alcyone.com
Wed Feb 18 01:47:49 EST 2004


Erik Max Francis wrote:

> Paul Rubin wrote:
> 
> > I'm still scratching my head over that PEP.  Got a real-world code
> > sample
> > that it would improve?
> 
>         do:
>             line = inputFile.readline()
>         while line:
>             ...
>             line = inputFile.readline()

Man, what a perfect gaffe on my part.  The purpose of the do...while
construct is to _eliminate_ the duplication.  This should be:

	do:
	    line = inputFile.readline()
	while line:
	    ...

-- 
 __ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/  \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ The doors of Heaven and Hell are adjacent and identical.
    -- Nikos Kazantzakis



More information about the Python-list mailing list