feature requests

Chris Angelico rosuav at gmail.com
Thu Oct 3 12:21:13 EDT 2013


On Fri, Oct 4, 2013 at 2:12 AM, macker <tester.testerus at 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



More information about the Python-list mailing list