Is there a more syntactically concise way of writing the following?
gen = (i for i in xrange(10)) index = 5 for i, v in enumerate(gen): if i is index:
one method would be to use itertools.islice
>>> gen = (x for x in range(10)) >>> index = 5 >>> next(itertools.islice(gen, index, None)) 5