[Tutor] Re: Abt python (using the sleep function in the time module)

Lloyd Kvam pythontutor@venix.com
Mon, 20 May 2002 18:32:22 -0400


 >>> import time
 >>> def take5():
... 	time.sleep(5)
... 	
 >>> def pause():
... 	print time.localtime()
... 	take5()
... 	print time.localtime()
...
 >>> pause()
(2002, 5, 20, 18, 29, 37, 0, 140, 1)
(2002, 5, 20, 18, 29, 42, 0, 140, 1)
 >>> pause()
(2002, 5, 20, 18, 29, 50, 0, 140, 1)
(2002, 5, 20, 18, 29, 55, 0, 140, 1)
 >>>
As you can see, when the sleep function is used like this, it pauses five
seconds every time.  There is probably something wrong with how your are
using it.

Also, you are better off mailing to the whole list rather than only me.  Someone
else will usually respond more quickly.

wonderer@pakistanmail.com wrote:

> Hi I was checking few python scripts which i wrote and found out something which
> i could not understand i hope u could help in this regard.
> My problem is I load a script and call a function defined in that script .
> Now this function has a "time.sleep(5)" statement.
> what happens is that first time script is "import"ed and that function called
> it goes to sleep for 5 secionds but if i call that function again it outputs
> the result without any  delay without executing any delay or sleep.
> I wonder if it is a problem with my code or something else.
> The only solution i m relying on is to reload everything from scratch.
> plzz any help
> TIA
> _______________________________________________________________________
> Get your free @pakistanmail.com email address   http://pakistanmail.com
> 
> 


-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice: 
603-443-6155
fax: 
801-459-9582