Q: how do i create a function that calls next item on list and cycles through it? I am having a hard creating a function that gives me next item on list and cycles through  it. I.e my list is range 20. With each call to my function i should get one item in that range and a subsequent call should give me next item + 1. Here is my start.
from itertools import cycle

def give_me_next(self, *args):
    my_list = range(20)
    saved = []
    # give me next item


A: If you've got a list with 'random' numbers you can use this:
list=[1,2,5,8,6,78,965,57,5]
b=iter(list)
try:
  while True:
    print b.next()
except:
  pass


A: Here is my approach, though it can be more elegant.
def give_me_next(lst):
    iterlst = iter(lst)
    return (iterlst.next(),lst[1:])

lst = range(20)
(x,lst) = give_me_next(lst)
print x # 0
(x,lst) = give_me_next(lst)
print x # 1
(x,lst) = give_me_next(lst)
print x # 2


A: Maybe a generator?
def next_item(my_list):
   index = 0
   while True:
       yield my_list[index%len(my_list)]
       index +=1

x = next_item([1,2,3])

for _ in range(100):
    print next(x)    

