Ned Batchelder: Loop Like A Native

Ned Batchelder ned at nedbatchelder.com
Sat Aug 6 19:38:21 EDT 2016


On Saturday, August 6, 2016 at 7:36:06 PM UTC-4, Ned Batchelder wrote:
> On Saturday, August 6, 2016 at 6:06:27 PM UTC-4, Lawrence D’Oliveiro wrote:
> > On Saturday, August 6, 2016 at 12:08:30 PM UTC+12, bream... at gmail.com wrote:
> > > A couple or three years old but this is well worth seeing for anybody,
> > > regardless of your Python expertise. http://nedbatchelder.com/text/iter.html
> > 
> > A loop like
> > 
> >     for i in ... :
> >        ...
> >        if ... cond ... :
> >            break
> >        ...
> >     #end for
> > 
> > actually has two different ways to terminate. Is there any good reason for them to be written two different ways?
> 
> Didn't we already do this debate?

For example: https://mail.python.org/pipermail/python-list/2016-June/709758.html

Maybe we don't have to revisit it... :)

--Ned.



More information about the Python-list mailing list