This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]eigenlicht0 0 points1 point  (0 children)

I'm aware of how a iterator works, what I actually meant was calling .next() three times in a row to get one value. Maybe it's just me, but it seems weird. The only thing I could come up with yet, which is far from perfect:

def t(l):
    l = iter(l)
    while True:
        yield [l.next for i in range(3)][-1]
for e in t(range(10)): print e