@
O5oz6z3 #10
import timeit
_iter = list(range(12345))
init = 'iter = _iter'
end = 'iter = list(iter)'
maketest = lambda stmt, n: '\n'.join([init, *[stmt]*n, end])
comp = 'iter = [x**0.5 for x in iter]'
>>> timeit.timeit(maketest(comp, 3), number=100, globals=globals())
1.33
>>> timeit.timeit(maketest(comp, 10), number=100, globals=globals())
4.26
gene = 'iter = (x**0.5 for x in iter)'
>>> timeit.timeit(maketest(gene, 3), number=100, globals=globals())
1.63
>>> timeit.timeit(maketest(gene, 10), number=100, globals=globals())
4.60