Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #55419

Re: feature requests

References <6782f295-1885-4114-aea8-d785480f3489@googlegroups.com>
Date 2013-10-04 02:21 +1000
Subject Re: feature requests
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.680.1380817277.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Oct 4, 2013 at 2:12 AM, macker <tester.testerus@gmail.com> wrote:
> I'd like to be able to `workers = [Thread(params).start() for params in whatever]`. Right now, it's 5 ugly, menial lines:
>
>         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()

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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