91 ms·
I've done concurrent programming in both Python and Go, and to be fair to Python, its standard library queue class (http://docs.python.org/library/queue.html ht
by jbarham 15y ago
I've done concurrent programming in both Python and Go, and to be fair to Python, its standard library queue class (http://docs.python.org/library/queue.html http://docs.python.org/library/queue.html) is very close to Go's channels so it does CSP style concurrency quite nicely.
However, Go's goroutines are IMHO superior to Python threads since they're much more lightweight and can run in parallel on multi-core CPUs and you can have a lot more of them.
Go gets it right by putting goroutines and channels into the core language to encourage CSP style concurrency, but putting other more traditional, but harder-to-use, concurrency primitives like mutexes into the standard library.
- luriel 15y agoI agree with most of your comment. But I'm sorry, this part is not even close: > its standard library queue class (http://docs.python.org/library/queue.html http://docs.python.org/library/queue.html) is very close to Go's channels so it does CSP style concurrency quite nicely. Among other things, it lacks any construct similar to Go's `select`, without which channels are nowhere nearly as useful. And then there are issues like what you point out about how incredibly cheap goroutines are.