Hacker News new | ask | show | jobs
by e12e 4378 days ago
To be fair, the syntax might not be as clean, but isn't:

    m = map(lambda x: x*2, range(100000000000000000000))
    i = itertools.islice(m, 10**6, None)
    next(i)
Somewhat equivalent? This does seem a little slow calculating the first million squares, but subsequent calls to next(i) are snappy(ish).

I'm not sure how close you could get to "truly" lazy sequences combining count, zip and slice, though.