3 ms·
Whenever I see a blog post on Python concurrency that recommends something other than concurrent.futures ThreadPoolExecutor or ProcessPoolExecutor, I shake my h
by ebg13 7y ago
Whenever I see a blog post on Python concurrency that recommends something other than concurrent.futures ThreadPoolExecutor or ProcessPoolExecutor, I shake my head in disappointment at how far we've strayed from "one obviously right way". Why in 2020 am I seeing someone manually close and join a worker pool (blocking!) to return all results all at once because they rewrote executor.map using multiprocessing? Why do they del pool immediately before returning instead of just letting it run out of scope? Why are they using map, which orders the result, if they just want to call all? If performance matters, you want to read the results in the order of completion not the order of submission, and you don't want to wait for all of them to complete if any of them fail. Where did Python's "right way" go sideways?
- chooseaname 7y agoIf I google for python concurrency the second link is to the docs: https://docs.python.org/3/library/concurrency.html https://docs.python.org/3/library/concurrency.html I don’t see where in the docs it says, it’s 2020 so do this from now on. Maybe that’s the problem?
- ebg13 7y ago> I don’t see where in the docs it says, it’s 2020 so do this from now on. Maybe that’s the problem? I guess lack of clear direction is exactly the problem. For all of PEP20's supposed importance, it's notoriously difficult to discover which parts of the standard library to use and which ones to ignore unless you like reinventing wheels.