liste = ['blah', 'blih', 'bluh'] iterateur = liste.__iter__() print iterateur.next() print iterateur.next() print iterateur.next() print iterateur.next() #Traceback (most recent call last): # File '', line 1, in ; #StopIteration class Iterateur: i = 0 def next(self): if self.i <= 10: raise StopIteration self.i += 1 return 2**self.i def __iter__(self): return self iterateur = Iterateur() for i in iterateur: print i