Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #55420
| Date | 2013-10-03 11:42 -0500 |
|---|---|
| From | Tim Chase <python.list@tim.thechases.com> |
| Subject | Re: feature requests |
| References | <6782f295-1885-4114-aea8-d785480f3489@googlegroups.com> <CAPTjJmpiiKtTioZ+kaZ12-Rk=Cre2iJubDE8CCuoJqq9YUxQNg@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.681.1380818429.18130.python-list@python.org> (permalink) |
On 2013-10-04 02:21, Chris Angelico wrote:
> > workers = []
> > for params in whatever:
> > thread = threading.Thread(params)
> > thread.start()
> > workers.append(thread)
>
> You could shorten this by iterating twice, if that helps:
>
> workers = [Thread(params).start() for params in whatever]
> for thrd in workers: thrd.start()
Do you mean
workers = [Thread(params) for params in whatever]
for thrd in workers: thrd.start()
? ("Thread(params)" vs. "Thread(params).start()" in your list comp)
-tkc
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
feature requests macker <tester.testerus@gmail.com> - 2013-10-03 09:12 -0700
Re: feature requests Chris Angelico <rosuav@gmail.com> - 2013-10-04 02:21 +1000
Re: feature requests Tim Chase <python.list@tim.thechases.com> - 2013-10-03 11:42 -0500
Re: feature requests Chris Angelico <rosuav@gmail.com> - 2013-10-04 02:42 +1000
Re: feature requests Ethan Furman <ethan@stoneleaf.us> - 2013-10-03 10:01 -0700
Re: feature requests macker <tester.testerus@gmail.com> - 2013-10-05 05:49 -0700
Re: feature requests Ethan Furman <ethan@stoneleaf.us> - 2013-10-05 08:58 -0700
Re: feature requests Terry Reedy <tjreedy@udel.edu> - 2013-10-05 17:56 -0400
csiph-web