Re: [Tutor] continuous running of a method

2010-08-26 Thread Steven D'Aprano
On Thu, 26 Aug 2010 12:27:03 pm R. Alan Monroe wrote: > > Any modern multi-tasking operating system will ensure than a while > > loop doesn't kill your computer's responsiveness. A decent > > operating system will still remain responsive even at 100% CPU > > usage. Even Windows does that! > > Opini

Re: [Tutor] continuous running of a method

2010-08-25 Thread R. Alan Monroe
> Any modern multi-tasking operating system will ensure than a while loop > doesn't kill your computer's responsiveness. A decent operating system > will still remain responsive even at 100% CPU usage. Even Windows does > that! Opinions vary. If you try this on a laptop, the end user will be qui

Re: [Tutor] continuous running of a method

2010-08-25 Thread Steven D'Aprano
On Wed, 25 Aug 2010 03:25:12 pm Nitin Das wrote: > The problem with this while loop is if your random value doesn't lie > between the mentioned range then ur 100% cpu would be utilized. The > one thing u can do is to sleep for some time lets say 0.5 sec after > every while loop iteration , in this

Re: [Tutor] continuous running of a method

2010-08-25 Thread Hugo Arts
On Wed, Aug 25, 2010 at 12:56 AM, Greg Bair wrote: > > It's not that the value doesn't lie between the mentioned range. > > What I'm doing is randomly fetching an item from a list of dicts > (multi-dimensional ones from a JSON response) and accessing a value from it, > but not every item has the k

Re: [Tutor] continuous running of a method

2010-08-24 Thread Greg Bair
On 08/25/2010 01:25 AM, Nitin Das wrote: The problem with this while loop is if your random value doesn't lie between the mentioned range then ur 100% cpu would be utilized. The one thing u can do is to sleep for some time lets say 0.5 sec after every while loop iteration , in this case ur cpu

Re: [Tutor] continuous running of a method

2010-08-24 Thread Nitin Das
The problem with this while loop is if your random value doesn't lie between the mentioned range then ur 100% cpu would be utilized. The one thing u can do is to sleep for some time lets say 0.5 sec after every while loop iteration , in this case ur cpu utilization will go down. --nitin On Mon, A

Re: [Tutor] continuous running of a method

2010-08-23 Thread bob gailer
On 8/23/2010 1:00 AM, Greg Bair wrote: I have a method (I'll call it foo) that will either return None or an object depending on a random value generated. What I want to happen is that if I call foo(), i.e, f = foo() and it returns None, to re-call it until it returns something else. I would

Re: [Tutor] continuous running of a method

2010-08-22 Thread Greg Bair
On 08/23/2010 01:10 AM, James Mills wrote: On Mon, Aug 23, 2010 at 3:00 PM, Greg Bair wrote: I have a method (I'll call it foo) that will either return None or an object depending on a random value generated. What I want to happen is that if I call foo(), i.e, f = foo() and it returns None

Re: [Tutor] continuous running of a method

2010-08-22 Thread James Mills
On Mon, Aug 23, 2010 at 3:00 PM, Greg Bair wrote: > I have a method (I'll call it foo) that will either return None or an object > depending on a random value generated.  What I want to happen is that if I > call foo(), i.e, f = foo() and it returns None, to re-call it until it > returns something

[Tutor] continuous running of a method

2010-08-22 Thread Greg Bair
I have a method (I'll call it foo) that will either return None or an object depending on a random value generated. What I want to happen is that if I call foo(), i.e, f = foo() and it returns None, to re-call it until it returns something else. I would think this would be done with a while l