from collections import Iteratorclass IterA(Iterator): def __init__(self,Itlist): self.Itlist = Itlist self.index = 0 def next(self): if self.index == len(self.Itlist): raise StopIteration a = self.Itlist[self.index] self.index +=1 return a