class test1(list): val=0 def __iter__(self): if self.val == 0: print 'first pass in test1.__iter__' self.val=1 self.__iter__=self.__str__ return list.__iter__(self) else: print 'still passing in test1.__iter__' return list.__iter__(self) b=test1((1,2)) for i in b: pass print b.__iter__ for i in b: pass