Message223547
This seems indeed like a weaker version of ThreadPoolExecutor. Here's how your example looks with it, not very different and still easy to understand and grasp:
from concurrent.futures import ThreadPoolExecutor
from urllib.request import urlretrieve
with ThreadPoolExecutor(max_workers=3) as executor:
url = 'http://www.{site}.org/'
for site in ('perl', 'python', 'jython', 'pypy'):
future = executor.submit(urlretrieve, url.format(site=site), site)
3 lines without imports and the initialisation of the pool. |
|
Date |
User |
Action |
Args |
2014-07-20 22:54:28 | Claudiu.Popa | set | recipients:
+ Claudiu.Popa, lemburg, tim.peters, aleax, rhettinger, pitrou, kristjan.jonsson, r.david.murray, neologix, Christian.Tismer, tinchester |
2014-07-20 22:54:28 | Claudiu.Popa | set | messageid: <1405896868.21.0.73433074232.issue22013@psf.upfronthosting.co.za> |
2014-07-20 22:54:28 | Claudiu.Popa | link | issue22013 messages |
2014-07-20 22:54:28 | Claudiu.Popa | create | |
|