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!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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'mrab': 0.05; 'python': 0.08; 'underlying': 0.09; 'unsigned': 0.09; 'exception': 0.12; 'am,': 0.13; 'wrote:': 0.15; '3.2.': 0.16; 'ioerror': 0.16; 'linux)': 0.16; 'subject:function': 0.16; 'valueerror': 0.16; "hasn't": 0.16; 'command': 0.19; 'cheers,': 0.19; 'seconds': 0.21; 'long,': 0.22; 'header:In-Reply-To:1': 0.22; 'changed': 0.25; 'expect': 0.25; '(or': 0.25; 'windows': 0.26; 'pass': 0.28; 'thu,': 0.28; 'message-id:@mail.gmail.com': 0.28; 'match': 0.30; 'semantics': 0.30; 'sleep': 0.30; 'looks': 0.30; 'it.': 0.33; 'to:addr:python-list': 0.34; 'some': 0.37; 'received:google.com': 0.38; 'received:209.85.161': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'showing': 0.38; 'should': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'sense': 0.40; '1000': 0.62; 'direct': 0.66; 'special': 0.67; 'cause': 0.69; '30,': 0.74; '11:18': 0.84; 'forever': 0.84; 'ms,': 0.84; 'subject:call': 0.91; 'killed': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=JZ5eXspl+jvrQhg1NjHQJaYA7fwGyghTw0XF8GjQYbI=; b=XK78xEyHIiCEmIkLdDdCFJnd4a3Gf7rK0Lz1TyfwMdKwiSQ+jbHVxTR9a6hrUigWXd wattIYtv77UYyXcgp9zItWbJs5Y1lMzEN+sf4S9MV4GyAj90bVONPlEQ24bfvN/ZkljY 3gXn1bkRHkmECYAm0HDI/Aqp5DFwIoVA1v8vY= MIME-Version: 1.0 In-Reply-To: <4E0CAFD5.50404@mrabarnett.plus.com> References: <4E0CAFD5.50404@mrabarnett.plus.com> From: Ian Kelly Date: Thu, 30 Jun 2011 11:42:54 -0600 Subject: Re: how to call a function for evry 10 secs To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1309455805 news.xs4all.nl 21849 [2001:888:2000:d::a6]:41742 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8611 On Thu, Jun 30, 2011 at 11:18 AM, MRAB wrote: >> =A0 =A0 =A0 =A0And that was a direct cut&paste from a command window; sh= owing it >> had slept for some 90 seconds before I killed it. >> > Looks like it hasn't changed even in WinXP, Python 3.2. It gets cast to an unsigned long, so I expect sleep(-1) on Windows would sleep for 2 ** 32 - 1000 ms, or about 49.7 days. More interestingly, sleep(-0.001) should pass 2**32 - 1 to the underlying Windows API, which would cause it to sleep forever (or until interrupted). > Is IOError what you'd expect, anyway? > > What should it do in Python 3.2? Exception or max(seconds, 0)? sleep(0) has some special semantics on Windows. Raising ValueError (or IOError to match Linux) makes the most sense to me. Cheers, Ian