List Comprehensions
Chris Angelico
rosuav at gmail.com
Mon Dec 22 01:06:37 EST 2014
On Mon, Dec 22, 2014 at 4:42 PM, Ganesh Pal <ganesh1pal at gmail.com> wrote:
> (a) I was trying to reduce the below piece of code using List comprehension
> ? Any suggestion please let me know
>
>
> for opt in options:
> opt['result'] = Queue.Queue()
> tmp_thread = pause.Thread(opt)
> threads.append(tmp_thread)
> tmp_thread.start()
>
> (b) Is there anything that I need to consider while using list
> comprehension with threads ?
Your code is doing several things at once, so it's probably not worth
trying to turn it into a comprehension. I don't think it needs to be
shortened, anyway; looks fine to me.
ChrisA
More information about the Python-list
mailing list