def __init__(self, x):
                  
                  
                          self.x = x
                  
                  
                          
                  
                  
                      def __iter__(self):
                  
                  
                          self.n = 0
                  
                  
                          return self.__iter__()
                  
                  
                  
                  
                  
                      def __next__(self):
                  
                  
                          if self.n >= len(self.x):
                  
                  
                            raise StopIteration
                  
                  
                          next = self.x[self.n]
                  
                  
                          self.n += 1
                  
                  
                          return next
                  
                  
                
смешиваешь логику итератора и коллекции
Обсуждают сегодня