Timed events

Alex Martelli aleax at aleax.it
Fri Jan 31 17:06:43 EST 2003


Sam Marrocco wrote:

> I'm trying to Python a script that will perform a function every few
> seconds. Is there a particularly efficient way to do this that won't hog
> processor time?

Module sched in the standard Python library is quite simple and
suitable for this purpose.  See:
    http://www.python.org/doc/current/lib/module-sched.html
for an example.  All you need is for the scheduled function
to re-schedule its own next call as appropriate each time.


Alex





More information about the Python-list mailing list