#!/usr/local/bin/python2 l = range(20) for i in xrange(500000): t = iter(l) r = next(n for n in t) for n in t: n print r