Idle bug

Jive Dadson jdadson at ix.netcom.com
Mon Nov 5 23:45:45 CET 2001


To the keepers of the bug list, whoever they may be.

Start Idle under Windows NT 4.x (idle.pyw).  Import the following module that's 
included at the bottom of this message.  (It's from the book _Core Python Programming_ 
by Wesley J. Chun.)  Idle will lock up.  You have to kill it from the Task Manager.

Jive



import threading
from time import sleep, time, ctime

loops = [4,2]

def loop(nloop, nsec):
	print 'start ', nloop, ' at: ', ctime(time())
	sleep(nsec)
	print 'loop ', nloop, ' done  at ', ctime(time())
	
def main():
		print 'starting threads'
		threads = []
		nloops = range(len(loops))
		for i in nloops:
			t = threading.Thread(target=loop,args=(i,loops[i]))
			threads.append(t)
			
		for i in nloops:
			threads[i].start()
		
		for i in nloops:
			threads[i].join()
			
		print 'all done at ', ctime(time())
		
if __name__ == '__main__':
	main()



More information about the Python-list mailing list