Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8611

Re: how to call a function for evry 10 secs

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 <ian.g.kelly@gmail.com>
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 <f63802d3-da39-4efb-a09a-89458a9c1f92@h38g2000pro.googlegroups.com> <mailman.518.1309410399.1164.python-list@python.org> <mvotd8-v5k.ln1@satorlaser.homedns.org> <iui922$6eq$1@dough.gmane.org> <4E0CAFD5.50404@mrabarnett.plus.com>
From Ian Kelly <ian.g.kelly@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.529.1309455805.1164.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Thu, Jun 30, 2011 at 11:18 AM, MRAB <python@mrabarnett.plus.com> wrote:
>>        And that was a direct cut&paste from a command window; showing 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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

how to call a function for evry 10 secs hisan <santosh.ssit@gmail.com> - 2011-06-29 10:39 -0700
  Re: how to call a function for evry 10 secs Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-30 03:42 +1000
  Re: how to call a function for evry 10 secs Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-06-29 22:06 -0700
    Re: how to call a function for evry 10 secs Laurent Claessens <moky.math@gmail.com> - 2011-06-30 09:05 +0200
    Re: how to call a function for evry 10 secs Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-06-30 10:37 +0200
      Re: how to call a function for evry 10 secs Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-06-30 09:42 -0700
        Re: how to call a function for evry 10 secs Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-06-30 21:04 +0200
          Re: how to call a function for evry 10 secs Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-06-30 23:29 -0700
          Re: how to call a function for evry 10 secs Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-07-01 08:50 +0200
      Re: how to call a function for evry 10 secs MRAB <python@mrabarnett.plus.com> - 2011-06-30 18:18 +0100
      Re: how to call a function for evry 10 secs Chris Angelico <rosuav@gmail.com> - 2011-07-01 03:36 +1000
      Re: how to call a function for evry 10 secs Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-30 11:42 -0600

csiph-web