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


Groups > comp.lang.python > #8638

Re: how to call a function for evry 10 secs

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: how to call a function for evry 10 secs
Date 2011-07-01 09:57 -0700
Organization > Bestiaria Support Staff <
References <f63802d3-da39-4efb-a09a-89458a9c1f92@h38g2000pro.googlegroups.com> <0dced078-212a-4841-9e1c-704697c4bcc6@glegroupsg2000goo.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.543.1309539450.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, 1 Jul 2011 09:15:19 -0700 (PDT), Rune Strand
<rune.strand@gmail.com> declaimed the following in
gmane.comp.python.general:

> from threading import Timer
> 
> def Func_to_call:
>    do_stuff()
> 
> my_timer = Timer(10, Func_to_call)
> my_timer.start()

	Timer() is a one-shot; per the OPs requirements even it would need
to be placed within a loop to invoke multiple calls -- so there isn't
much gain in terms of lines of code... And worse, since it calls the
function asynchronously and not sequentially, a delay time for each
instance would have to be computed inside the loop too...
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


Thread

Re: how to call a function for evry 10 secs Rune Strand <rune.strand@gmail.com> - 2011-07-01 09:15 -0700
  Re: how to call a function for evry 10 secs Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-07-01 09:57 -0700

csiph-web