4 ms·
> As a python dev, pythons multiprocess/multithreading story is one the largest pain points in the language. Hmm, how is that so? As a python dev as well, I d
by Galanwe 4y ago
> As a python dev, pythons multiprocess/multithreading story is one the largest pain points in the language.
Hmm, how is that so?
As a python dev as well, I don't have much complaint with multiprocessing.
The API is simple, it works OK, the overall paradigm is simple to grok, you can share transparently with pickle, etc.
- nine_k 4y agoMultiprocessing is fine, but the cost of starting another interpreter is pretty visible, so you need to create a pool, and it may not be an overall speedup if the run time is short. It takes more careful planning than async in JS?, say, or goroutines.
- geysersam 4y agoYeah but for JS style async you'd use probably use an event loop in Python, not multi processing.
- nine_k 4y agoYes. But, frankly, async is also simpler in JS than in Python: e.g. no need to start a reactor loop.
- Too 4y agoStarting the event loop is no worse than any setup of a main function, it’s a oneliner: asyncio.get_event_loop().run_until_completion(my_async_main)
- BerislavLopac 4y agoErrr no, that has been replaced with asyncio.run quite some time ago.
- plonk 4y agoPickle isn't transparent though, custom objects that wrap files or database sessions need to override serialization. The ProcessPoolExecutor is nice but shouldn't be necessary.