r/programming • • Apr 16 '14

Why I went from Python to Go (and not node.js)

http://jordanorelli.com/post/31533769172/why-i-went-from-python-to-go-and-not-node-js
0 Upvotes

11 comments sorted by

8

u/Hueho Apr 16 '14 edited Apr 16 '14

It... Kind of ended from nowhere, didn't it?

I mean, there is a lot of words explaining why you was discontent with concurrency in Python, which felt not idiomatic, then with concurrency in Node, which is tied to a single-thread model, and then it more or less ended as "oh, someone told me Go is fast, I liked it, here are two 'helloworld http-servers' in Node and Go to prove something".

I mean, we know why Go is a good choice when you need concurrency (goroutines, the scheduler, etc), but most people who don't know the language will just scratch heads at the end.

Meaningless edit: I could swear I was in /r/golang.

3

u/lambdaq Apr 16 '14 edited Apr 16 '14

Looks like OP is abandoning Python because of the synchronous & blocking nature of WSGI, which is what django based upon.

But he might not be aware that Django can run on async containers, too. Like Gevent/Tornado/Twisted. Which makes writing async code flow very easy.

1

u/grizwako Apr 16 '14

I got same impression. For handling concurrency for async IO needs, Python is perfectly capable.
If I needed to get some real performance for CPU bound stuff, and pypy does not satisfy situation, golang would probably be my choice too.

1

u/der_anomalizer Apr 27 '14

(c)python continues to have issues when it comes to parallelism. Spawning off a new process either explicitly or implicitly to use multiple cores is the reason why I'd shy away from the language.

1

u/grizwako Apr 28 '14

Can you please read my comment up there again?
It says for handling "async IO needs".
You don't need threads to do async IO.
There are much simpler and cleaner way to handle it. I never mentioned that I would use Python for multithreading, and as a matter of fact, I never used Python's threading tools. I used some frameworks and engines where threading happens on other layer, and some layers just happen to be written in Python.

6

u/[deleted] Apr 16 '14 edited Apr 16 '14

Seriously, you turned to Go because you want to send email from a goroutine when handling http request? You DO need something like celery for this stuff. Trust me with this one.

1

u/rini17 Apr 16 '14

Turbogears is more mature than Django in this regard, you don't need to manage the concurrency yourself (only choose one threaded or gevent-based server) and it has asyncjob extension, too.

-7

u/all_it Apr 16 '14

People often ask me why I have decided that I’d be writing the bulk of my new code in Go, which I started programming in November of 2011 while attending Hacker School.

0

u/[deleted] Apr 16 '14

[deleted]

1

u/der_anomalizer Apr 27 '14

golang's concurrency channels effectively act as task queues

1

u/grizwako Apr 28 '14

For me sending email is just IO, and that can be handled asynchronously, and for that we do not need threads.

0

u/[deleted] Apr 28 '14

[deleted]

1

u/grizwako Apr 28 '14

I completely agree :)
I meant that if for "some reason" you will not use proper task queue, you can just as well avoid threads.