Claudiu Popa added the comment:
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.
----------
nosy: +Claudiu.Popa
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue22013>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com