r/Python • • 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
4 Upvotes

14 comments sorted by

7

u/cantremembermypasswd Apr 17 '14

A month after Python 3.4 is realeased, a blog post about switching to Go because of concurency, and not a single mention of asyncio...

I think someones just excited over learning a new language ;-)

2

u/erewok Apr 17 '14

I had a similar thought. This blog post would have been harder hitting in 2013. Now it feels like there is a glaring admission.

-6

u/[deleted] Apr 17 '14

didnt read it did you? you just scanned for asyncio.... be honest.

6

u/cantremembermypasswd Apr 17 '14

Read it and found it interesting honestly. But a lot of negatives you addressed with pythons approach to concurrency they have been working on for a while and addressed with a new standard library.

I agree it is no Go, as Go was designed with that goal in mind from the beginning. I just was noting the article was only comparing non standard python modules with the built-ins of others.

-1

u/[deleted] Apr 17 '14

i'm not the author of the blog post. I was just the person who found it and shared the link in this /r/

15

u/log_2 Apr 17 '14

This is how it feels to code in Go:

me: "Let's try this..."

gc: "No, peasant! You have to scroll up and remove the unused import, now!"

me: "Sigh, ok. Up I go, removing unused import."

gc: "You still have those unused variables, remove them!"

me: "Ok, Master. How about now?"

gc: "Very well, let me see what I can do."

This is how it feels to code in Python:

me: "Let's try this..."

python: "Go for it boss!"

13

u/lambdaq django n' shit Apr 17 '14

This is how it feels to code in Go:

1. rtn, err := wtf is the type for X?
2. if err != nil { log.Fatal(err) } 
3. rtn, err := lookup docs for type X
4. if err != nil { log.Fatal(err) } 
5. rtn, err := now I want to convert it to type y
6. if err != nil { log.Fatal(err) } 
7. rtn, err := wtf is the type for y?
8. if err != nil { log.Fatal(err) } 
9. rtn, err := crap I can't inline convert type here. has to be two lines
10. if err != nil { log.Fatal(err) } 
11. rtn, err := convert type bitch! new_x := x.(typeY)
12. if err != nil { log.Fatal(err) } 
13. defer kill(*myself)

1

u/GFandango Apr 17 '14

defer kill(*myself)

I lost it

1

u/wting Apr 18 '14

To be fair you can suppress error messages, which is implicitly what most Python developers do when they write code that doesn't handle all possible exceptions.

25

u/jonathan_hepp Apr 17 '14

What if I tell you that you don't have to write a blog post everytime you change to other programming language.

6

u/hairycode Apr 17 '14

It was still a well written blog post. I enjoyed his explicit reasoning regarding the gaps he saw and how he filled them.

5

u/jgehrcke Apr 17 '14

Python and Go are not comparable. Go has not been built for replacing Python!

This is implicitly said in the blog post. Regarding concurrency, yes, Go is convincing. Go's architecture has been designed for this, from the very beginning. Hence, if you need to write a specialized application that should be fast and scale out very well on one machine, then Go for it! That is no surprise. The title "Why I went from Python to Go", however, is not what I would have written. Use the right tools, according to the task. Most of the times this is still Python.

7

u/spitfiredd Apr 16 '14

"but more in touch with reality than the grey-bearded wizards of Lisp/Haskell/whatever that sat in their caves/towers/whatever solving contrived, nonexistent problems for people that don’t exist, or those insane Erlang programmers who are content writing sumerian cuneiform all day long"

That was worth the read.

0

u/pemboa Apr 17 '14

A distributed task queue? What? I just want to do something in the background without making the user wait; I don’t need some super comprehensive ultimate computing machine.

If you think Celery is a "need some super comprehensive ultimate computing machine", it diminishes the authority of your opinion to me.