how to call a function for evry 10 secs

Chris Angelico rosuav at gmail.com
Thu Jun 30 13:36:12 EDT 2011


On Fri, Jul 1, 2011 at 3:18 AM, MRAB <python at mrabarnett.plus.com> wrote:
> Looks like it hasn't changed even in WinXP, Python 3.2.
>
> Is IOError what you'd expect, anyway?
>
> What should it do in Python 3.2? Exception or max(seconds, 0)?

The obvious thing for it to do is to go back in time and resume
executing that many seconds ago, but failing that, I would have it do
the latter. It's already documented as potentially sleeping a bit
longer than the specified time (for instance, it's rounded up to the
minimum resolution, and task switches can increase the time), so it's
not much of a stretch to have negative sleep times result in a
yield/context switch and no further sleeping.

ChrisA



More information about the Python-list mailing list