3 ms·
It’s arguable whether either of those are ‘in python’.
by zepto 7y ago
It’s arguable whether either of those are ‘in python’.
- quacker 7y agoThe multiprocessing module in the standard library is absolutely a Python-native way to do parallelism: with Pool(5) as p: print(p.map(f, [1, 2, 3])) This runs f(1), f(2), and f(3) in parallel, using a pool of five processes. https://docs.python.org/3.6/library/multiprocessing.html https://docs.python.org/3.6/library/multiprocessing.html
- goostavos 7y agoWhoa! It never occurred to me that `Pool` could be used with context manager. I've always typed out `.close()` manually like a sucker.
- kbutler 7y agohttps://docs.python.org/2/library/multiprocessing.html https://docs.python.org/2/library/multiprocessing.html Python standard library since 2.6. Pretty much the definition of "in python".