@classmethod
    def loop(cls, f, **kwargs):
        def _loop(*args, **kwargs):
            while True:
                try:
                    f(*args, **kwargs)
                except TaskletExit:
                    break
                except:
                    logging.exception("unhandled exception in Tasklet.loop")
                    cls.sleep(1.0) #prevent hogging the cpu if exception repeats
        
        return cls.new(_loop, **kwargs)
Creates a new task that will execute the given callable *f* in a loop.
dataset/ETHPy150Open concurrence/concurrence/lib/concurrence/core.py/Tasklet.loop