Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'instance,': 0.05; 'mrab': 0.05; 'python': 0.08; 'rounded': 0.09; 'switches': 0.09; 'exception': 0.12; 'am,': 0.13; 'received:209.85.214.174': 0.13; 'received:mail-iw0-f174.google.com': 0.13; 'wrote:': 0.15; '3.2.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ioerror': 0.16; 'sleeping': 0.16; 'subject:function': 0.16; "hasn't": 0.16; 'executing': 0.19; 'seconds': 0.21; 'header:In- Reply-To:1': 0.22; 'documented': 0.23; 'changed': 0.25; 'specified': 0.25; 'fri,': 0.28; 'received:209.85.214': 0.28; 'bit': 0.28; 'message-id:@mail.gmail.com': 0.28; 'sleep': 0.30; 'looks': 0.30; 'to:addr:python-list': 0.34; 'that,': 0.35; 'switch': 0.35; '(for': 0.36; 'minimum': 0.37; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'back': 0.63; 'increase': 0.64; 'further': 0.65; 'resolution,': 0.84; 'stretch': 0.91; 'subject:call': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=mc7BbOQqJ16wBNgnzO7djZ3h5vQl3zcelhVBIm6VrYU=; b=uazRw/RsoyBrP4ij/c5rfdKfmCEbkBspstRURo3KfZe7EmVpO3rv2JapWp8FFzAyt/ MBVw9j22FsU26CrS8IzkEntfxicbJxSeGw2xyWKQLHTRBUysBG1e7V0LeKQ1fTy6gQAh xSKu+MBeLylnRONHJ9fbQyObeXflXpIRVmLPU= MIME-Version: 1.0 In-Reply-To: <4E0CAFD5.50404@mrabarnett.plus.com> References: <4E0CAFD5.50404@mrabarnett.plus.com> Date: Fri, 1 Jul 2011 03:36:12 +1000 Subject: Re: how to call a function for evry 10 secs From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1309455375 news.xs4all.nl 21846 [2001:888:2000:d::a6]:52254 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8610 On Fri, Jul 1, 2011 at 3:18 AM, MRAB 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