[Python-ideas] Aid reiteration with new class: gfic

Mathias Panzenböck grosser.meister.morti at gmx.net
Sat Jun 20 16:56:14 CEST 2009


Greg Ewing wrote:
> John Graham wrote:
> 
>> Hrm, that leads to the question, is it mathematically possible to 
>> iterate over an infinite list... twice? :)
> 
> Sure, as long as you don't insist on finishing the
> first iteration before starting the second one...
> 
> And it takes exactly the same amount of time as
> doing it once. :-)
> 

Thats what I was thinking about. Like:

def foo(seq):
    for x, y, z in izip(seq, islice(seq,1,None,2), islice(seq,2,None,3)):
       ...



More information about the Python-ideas mailing list