|
|
|
|
|
by FreakLegion
1006 days ago
|
|
The point of the article is a handful of lines. The rest is accoutrement like the URL list and timing code. But sure, if tasks = {}
for url in URLs:
future = executor.submit(fetch_url, url)
tasks[future] = url
bothers you, this is perfectly (some would say more so even than the original) Pythonic: tasks = {executor.submit(fetch_url, url): url for url in URLs}
|
|