Why I went from Python to Go (and not node.js)
21–30 of 202 posts
Re: Why I went from Python to Go (and not node.js)
#22 var cluster = require('cluster')
, http = require('http')
, os = require('os')
if (cluster.isMaster) {
os.cpus().forEach(cluster.fork)
} else {
http.createServer(function(req, res){
res.writeHead(200)
res.end('Hello world')
}).listen(8000)
}Re: Why I went from Python to Go (and not node.js)
#23Re: Why I went from Python to Go (and not node.js)
#24Dimissing Erlang and Haskell with a wave of the hand, while seriously considering node.js? Carry on, nothing to see here.
That could have been written better. Thanks for the feedback.
Re: Why I went from Python to Go (and not node.js)
#25Lots of sentiment, not much substance. Concurrency support is possible in Python, without gevent-style monkey patching (or callback madness). Have a look at concurrent.futures and http://www.dabeaz.com/coroutines/index.html . It really needs a lot more work before it's part of the language's DNA, though. Also, pypy needs much wider adoption as quickly as possible, to address the speed problems (and its STM branch hol…
"For me, Go's major shortcoming is its community's lack of focus on readability as compared to Python." Can you be a bit more concrete here? Because whether you like the code styles enforced by gofmt and the compiler itself or not, Go is the most consistently readable language I've ever used (once you adapt yourself to the language). IMO, this seems like an especially odd problem for someone to have with Go.
Re: Why I went from Python to Go (and not node.js)
#26In Go, the coroutines are in the same thread. There is a single thread here too(just like node.js). Coroutines are just multiplexed to the one main thread. Multi-Core Processing is handled by coroutine internals too i.e. there may or may not be more than one threads and even if there are more than one threads, they too will be multiplexed with the one main thread.
.. until you set runtime.GOMAXPROCS(runtime.NumCPU())
Re: Why I went from Python to Go (and not node.js)
#27Dimissing Erlang and Haskell with a wave of the hand, while seriously considering node.js? Carry on, nothing to see here.
ah, so, I don't think I wrote that section particularly well. I hold Erlang and Haskell in very high regard; I was really trying to mock my own superiority complex, which I think is fairly common in the Python community. I guess what I was really trying to get at is that Go is verymuch an industry language. Haskell I would argue against being an industry language not because it can't be used in industry; that's not a…
> Haskell I would argue against being an industry language
FYI, the problems the Haskell community has been working on are things like scalability, performance and safety because they're critical to industrial problems. Toy approaches don't work at the scale we operate at -- you need real computer science.
You want 1,000,000 Haskell threads in your app? You've got it. Want to write numerical models that compete with C++ code, in a fraction of the development time? Done. Want to guarantee the app won't crash? Solved. Run models over 10,000 cores? It happens.
Because we put the work in.
---
/me wanders back to a multi-million line Haskell codebase running systems in 25 countries, processing billions a year in financial transactions.
Re: Why I went from Python to Go (and not node.js)
#28This made me laugh, thank you.
Re: Why I went from Python to Go (and not node.js)
#29Source code changes could be saved as log-structured patch files, which could then be thrown away or applied to the source tree as desired. One could also steal some ideas from the Smalltalk Change Log tool by adding similar editing, search, and filtering commands.
With tools like this, one could recompile for "interpreted debug mode," have complete visibility and control of runtime state to debug a problem, then take the resulting patch file and apply it to the source tree. It would be a best of both worlds scenario -- all the enhanced debugging of an interpreted runtime with the type safety and speed of compiled code.
Re: Why I went from Python to Go (and not node.js)
#30It it true there's no way to spawn a background task in Django without making the user wait?