Hello

I've a list of tasks to perform. Each of them is a threading.Thread. Basically I have :

while task_list :
   task = task_list[0]
   task.run()
   task_list.remove(task)


Now I want, in some circumstance to raise errors that make the loop stop.

In order IOError to make stop the loop, I tried this :

no_error = True
while task_list and no_error:
   task = task_list[0]
   try :
      task.run()
   except IOError :
      no_error = False
   task_list.remove(task)

But it does not work (I think the exception is raised too late).

I prefer that the taske are not aware to be included in a loop, but I can make them raise personnal exceptions.
How can I do ?


Thanks
Laurent
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to