Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82752
| References | <CACT3xuWVZPqEZ-hQ6QS7QTnpuBG3FXvVuc=wVN5PLLM7FPrscQ@mail.gmail.com> |
|---|---|
| Date | 2014-12-22 17:06 +1100 |
| Subject | Re: List Comprehensions |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17109.1419228400.18130.python-list@python.org> (permalink) |
On Mon, Dec 22, 2014 at 4:42 PM, Ganesh Pal <ganesh1pal@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
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: List Comprehensions Chris Angelico <rosuav@gmail.com> - 2014-12-22 17:06 +1100
Re: List Comprehensions Roy Smith <roy@panix.com> - 2014-12-22 08:07 -0500
Re: List Comprehensions Chris Angelico <rosuav@gmail.com> - 2014-12-23 00:21 +1100
Re: List Comprehensions Rustom Mody <rustompmody@gmail.com> - 2014-12-22 06:58 -0800
Re: List Comprehensions Chris Angelico <rosuav@gmail.com> - 2014-12-23 02:07 +1100
Re: List Comprehensions Rustom Mody <rustompmody@gmail.com> - 2014-12-22 09:45 -0800
csiph-web