Final state of underlying sequence in islice

Peter Otten __peter__ at web.de
Sat Nov 6 10:31:12 CET 2010


Raymond Hettinger wrote:

> If the RightAnswer(tm) is obvious to you, I would
> like to hear it.  

It isnt ;)

> If I had to make a choice right
> now, I would choose stopping at the earlier possible
> point rather than scanning to the next natural
> boundary.

+1

Not because it leaves the underlying iterator in a more useful state (I 
think it doesn't), but because I like the principle that generators do as 
little work as possible.

Peter 




More information about the Python-list mailing list