Indexing enumerated functions

How do you find the iterative value in an enumerative function?

This is very unclear. Example?

import itertools
from itertools import cycle

n = cycle([0,1])
y = enumerate(n)
m = y.index(2)
#m is pseudocode

By design, iterators like itertools.cycle are not random-access. Getting the nth value will require calculating the previous values, at least indirectly.

To simplify that code - and assuming that you don’t really just want to write a loop over the iterator - consider: