Тема: про генератори і декоратори
я написав красивий клас Веселка, який вміє друкувати кольори веселки безконечно по циклу
ось:
class Rainbow:
    colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet',]
    def __init__(self, circle=True):
        self.circle = circle
    
   
    def _get_colors(self):
        i = 0
        while self.circle:
            yield self.colors[i]
            i += 1
            i %= len(self.colors)
            
    
    def __iter__(self):
        if self.circle:
            iterator = iter(self._get_colors())
        else:
            iterator = iter(self.colors)
        return iterator
   
for color in Rainbow(circle=False):
    print(color)
input('Press "Enter" to continue')        
    
for color in Rainbow():
    print(color)але , виникла потреба виводити кольори з затримкою 2 секунди
написав декоратор:
import time
def sleep_it(f):
    def wrapper(*args, **kwargs):
        time.sleep(2)
        f(*args, **kwargs)
    return wrapperобгорнув _get_colors(self) і отримав дулю(TypeError: 'NoneType' object is not iterable). 
чому я не можу застосувати декоратор до генератора?
