itertools.cycle().next()?
iter.next()
was removed in python 3. Use next(iter)
instead. So in your example change itertools.cycle().next()
to next(itertools.cycle())
There is a good example here along with various other porting to python 3 tips. It also compares various other next()
idioms in python 2.x vs python 3.x
In Python 3.x, iterators don't have it.next()
any more. use next(it)
instead, which also works in Python 2.6 or above. Internally, this will call it.next()
in Python 2.x and it.__next__()
in Python 3.x.