[ create a new paste ] login | about

Link: http://codepad.org/cV7HpHpv    [ raw code | fork ]

Python, pasted on May 21:
#!/usr/bin/env python


from random import randint


from circuits import Component, Event, Timer


class App(Component):

    def init(self):
        Timer(5, Event.create("run_often"), persist=True).register(self)
        Timer(3, Event.create("run_less_often"), persist=True).register(self)
        Timer(randint(1, 10), Event.create("run_randomly")).register(self)

    def run_often(self):
        print "Run Often"

    def run_less_often(self):
        print "Run Less Often"

    def run_randomly(self):
        print "Run Randomly"

        Timer(randint(1, 10), Event.create("run_randomly")).register(self)


App().run()


Create a new paste based on this one


Comments: