better scheduler with correct sleep times

Lie Lie.1296 at
Mon Oct 20 13:50:06 CEST 2008

On Oct 19, 4:01 am, sokol <tvrtko.sokolov... at> wrote:
> > > I started googling for scheduler and found one in standard library
> > > but ih has the same code as mine (it calls the  functions in the
> > > right order and my doesn't, but it still waits too long).
> > > The other schedulers from web are dealing with
> > > repeating tasks and such.
> > I believe you're looking for the 'sched' module:
> The sched module behaves just like mine version because
> it uses almost the same code. My observations include the
> sched module as well. Check it's source code. It is flawed:
> it calls the sleep method and while it sleeps (presumably
> for a long time) all newly scheduled events are on hold.
> See my example in original post.
> My code solves this problem (or so it looks to me right now).

Alternatively, if you're only handling Timers, you could use an event
loop that would check a list of timers and check their expiry time,
and execute the appropriate callback when the timer expired.

More information about the Python-list mailing list