simple Thread question

Beeyah dbickett at gmail.com
Wed Aug 18 02:48:11 CEST 2004


adeger at netlibrary.com (adeger) wrote in message news:<b8001e9f.0408031151.4f617c6 at posting.google.com>...
> 	def run(self, name):
> 		import time
> 		for i in range(1,11):
> 			print 'thread ', name, ' instance ', str(i)
> 			time.sleep(1)

You're importing the time module for every TestThr() object you
create, that's no good. You only need to import the module once, at
the beginning of the file like you've done with threading.



More information about the Python-list mailing list