threaded code in IDLE

Kurt B. Kaiser kbk at shore.net
Mon Feb 2 22:57:08 EST 2004


Matt Leslie <matthewleslie at hotmail.com> writes:

> This code:
>
> **************
> import thread
>
> def doprint(i):
>      print i
>
> for i in range(0,100):
>      thread.start_new_thread(doprint,(i,))
> *************
>
> Will run fine from the windows command line, but consistently
> crashes IDLE on windows (it locks up with no error message)
>
> Is this a known bug?

Which IDLE? Which Python? Which Windows?

Works for me on Windows2000, Python 2.3.2, Idle 1.0


If I run a thousand threads IDLE uses over 64MB unless I add a little
delay in between spawning threads.  Using the Python interpreter, not
IDLE, I can add a time.sleep(.0000015) and get away with 10,000
threads piling up with output to print.  IDLE needs more time, try .01
sec and watch your Task Monitor.  (Though 100 threads isn't much of 
a load....)

-- 
KBK



More information about the Python-list mailing list