CPU usage of Python interpreter doing empty while loop under XP
Jon Perez
jbperez808 at wahoo.com
Tue Apr 27 12:40:42 EDT 2004
Peter Hansen wrote:
> How does that help your debugging? That will tell us whether
> sleep(0) is a better alternative, or whether there is really
> something else you should be doing instead.
>
> (I have never had occasion to use "while 1: pass" in Python, ever.)
>
> -Peter
I'm trying to debug an event-driven framework I wrote myself and
there are some iffy situations where a quick and dirty way to halt
execution and view the state of some variables with print is to
insert a while 1: pass (or sleep(0)).
The only reason sleep(0) is better than pass in my situation
is that when I try to do other things under the OS before I've
had a chance to break out of the program, I don't get a slowdown.
More information about the Python-list
mailing list