Live data from Hacker News

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

orel.li

131–140 of 202 posts

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

#131
post #20

Another gonatic? I'm immediately reminded of the days when everyone who liked D proclaimed it would overtake C++ and rule the world with terrible, contrived examples: "let me show you why my language is better than yours by completely misunderstanding how to solve a problem, then implementing that broken/overengineered solution in your language, then compare it to something my language's API can do for me, just so we…

Someone should probably write a refresh to HQ9+ to include a web hello world as well as a Fibonacci server, and perhaps the Arc Challenge as well. (For more information on HQ9+, go here: http://web.archive.org/web/20090602074545/http://www.cliff.b...)

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

#132
post #31
post #20

Another gonatic? I'm immediately reminded of the days when everyone who liked D proclaimed it would overtake C++ and rule the world with terrible, contrived examples: "let me show you why my language is better than yours by completely misunderstanding how to solve a problem, then implementing that broken/overengineered solution in your language, then compare it to something my language's API can do for me, just so we…

Big difference is that D did not have a Google backing it and D had a fairly major falling out by different factions. This was a great pity because I think it probably is one of the best languages ever made and didn't get the take up it absolutely deserved.

If Google itself is really backing anything, it is Java.

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

#133
post #17

Earlier quoted context omitted.

"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.

Idiomatic Go: http://golang.org/doc/effective_go.html Idiomatic Python: http://python.net/~goodger/projects/pycon/2007/idiomatic/han... (doesn't cover a number of important things) When comparing the two, I'm not impressed with Go.

What makes you unimpressed? Why do you think that Python clearly wins? Do you think that the additional type safety, namespace safety, and ease of concurrency in Go are worth nothing? Or do you just think that Python has more that outweigh that?

I know that I frequently kick myself in Python when I typo a name somewhere, and everything dies far beyond where I made the mistake because it goes along happily storing something into that typoed variable, and then when I read it later it has the wrong value, and it takes me a while to trace back and find where I made the typo.

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

#134
post #117

Earlier quoted context omitted.

Probably not if that's what you start with. Carnegie Mellon now starts all CS students with ML, I believe. For those of us who learned to program in an imperative language first, the difficulty with learning functional programming is unlearning all of our bad habits.

"Functional programming" is 10% of what makes Haskell difficult. The intricacies of laziness and existential types and opimizing higher order functions are more the problem.

Very true. One of my first forays into Haskell came during the Google Code Jam, after seeing how short and elegant Reid Barton's solutions where. I solved the problems, but the programs were horribly slow, so I checked how Reid got around it: oh, he doesn't just map things and use the standard style, he needs some special constructs from the libraries.. it looks mathematically equivalent, but it looks plausible that the old way ends up holding onto too much data in memory. I eventually stopped when I realised that it would always take more time than hammering it out in C++, even if the final product in Haskell is shorter and more elegant. In fact, outside of writing APIs and frameworks, the desire for elegance seems debilitating. This also reminds me of how when I was most seriously practicing for Topcoder I could consistently produce shorter solutions than tomek (the top ranked guy far and away at that time) he would finish more quickly, since once he types it in it's done. For the record I'm now using Python (and some R) but I think I'd like Go.

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

#135

Earlier quoted context omitted.

"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.

Agreed. I think we, as a profession, have a tendency to focus on what's "easy" (syntax and constructs we're already familiar with) to the exclusion of other, potentially more important factors. I am and have been guilty of this myself, so I'm not claiming any sort of sainthood, just making an observation. Often people pick on the use of single-letter variable names as "unreadable." This is mostly a matter of keeping…

The biggest gripe I have with single-letter variable names is that they invariably require mental translation to their full names before anyone can understand how they're being used. Even for those who wrote the code in question.

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

#136

Earlier quoted context omitted.

Is there anything to add? It's not very fast. It does not have any interesting abstraction. It doesn't push the envelope further. It doesn't allow any clever optimizations. It has a bunch of horrible gotchas (scoping, mutable default arguments, tuples of one element...). It isn't elegant--the grammar alone takes pages and it's just a loose collection of mostly orthogonal features with largely arbitrary (but, admitted…

There is no 'horrible gotcha' with tuples of one element. Have you even tried generator expressions? Do you have any specific performance problem, or do you just suppose that you couldn't write sufficiently performant code in Python? Overall, from your post, I don't believe you have used Python seriously. I don't care what color Python would be, nor would I care what ice cream flavor it would be. Nor do I care whethe…

For what it's worth, I've used Python professionally and in several classes. I certainly don't have much experience in it, but it would be odd if I did--why would I use a language I don't particularly like too much?

You only say there are no horrible gotchas with tuples because you've never spent hours hunting down a bug and finding that you forgot a trailing comma. More pertinently, changing something like

    ("foo",
     "bar",
     "baz")
to

    ("foo")
actually breaks the code. This style is used often in configuration scripts (e.g. for Django) and certainly got me before. I don't really see what generator expressions have to do with anything.

The performance problem isn't a problem per se--the performance just isn't good. But this does not mean it's bad! That was really the whole point of my post; the performance, like everything else about the language, is unimpressive. In my experience, even naively written Haskell tends to perform better while being shorter and easier to write.

My point with Lambda the Ultimate was more general--I've noticed that the more programming language oriented a community is, the less people like Python. The people who spend the most time thinking about and working on different programming languages--the denizens of Lambda the Ultimate--are the ones who like it least. It's very much like music that musicians don't like.

What I meant by lowest common denominator is that you could get virtually anybody, regardless of skill level, to use Python. C is far more tricky--and has far more odd edge cases and ways to shoot yourself in the foot--than Python. It trades this for lower-level hardware access and performance, but this makes it far less of a LCD language than Python.

This is not a matter of "cool"--and it's not even a matter of Python being a bad tool. It's a matter of Python not being an outstanding, or, honestly, even a good tool. And, as I said, this is perfectly fine; there are plenty of reasons to choose a solid tool you know well over something that may even be strictly superior. I can even understand why people would like this; many people like something approachable and bland over something seemingly exotic but also exciting.

But this does not fit with Python's general hype. People trot Python out as the gold standard of language design and are rather proud of themselves (as the post starting this whole discussion parodied) without having the substance to back that attitude up.

And all this goes back to the original thesis: Python is not actively bad, but it is also not actively good--it occupies a rather uninteresting middle ground. This is only surprising in light of its somewhat incongruous reputation as one of the best languages in certain circles.

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

#137

Earlier quoted context omitted.

There is no 'horrible gotcha' with tuples of one element. Have you even tried generator expressions? Do you have any specific performance problem, or do you just suppose that you couldn't write sufficiently performant code in Python? Overall, from your post, I don't believe you have used Python seriously. I don't care what color Python would be, nor would I care what ice cream flavor it would be. Nor do I care whethe…

For what it's worth, I've used Python professionally and in several classes. I certainly don't have much experience in it, but it would be odd if I did--why would I use a language I don't particularly like too much? You only say there are no horrible gotchas with tuples because you've never spent hours hunting down a bug and finding that you forgot a trailing comma. More pertinently, changing something like ("foo", "…

I like how after all these paragraphs you've managed to avoid having to offer up your own personal example of a "good" and "outstanding" language. But have no problem labeling other languages as NOT being such, with very poor examples :P

You should get an achievement of some sort. Hackernews needs achievements.

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

#139
post #113

Earlier quoted context omitted.

I can't speak for @ak217, but for me Go hits a bad spot on "expressibility". Some of the nuances of static typing are mitigated a bit with features, yes, like the type inference on local variables, or the automatic interface detection (i.e. no explicit "type X implements Y"). But overall, i think the chosen type system is lacking on expressibility. Having no parametric polymorphism in a static language is a deal brea…

You can use reflection to get parametricity. Python doesn't have type safe anything , so Go bests Python on that front.

If I'm going to be burdened by a static type system, then I expect it to do certain things for me in return. One of those things that I take as a given is that a static type system can check that my basic use of types in my program are safe.

Not being able to type-check something as simple as a container lookup is a show-stopper for me because using containers is a huge part of day-to-day programming. Static typing without parametric polymorphism is extremely retrograde -- like Java in the 90's.

I've read rsc's essays on adding parametric polymorphism to Go -- I'm not saying it's a "duh -- just add parametric polymorphism". I'm well aware of the issues -- I'm just saying that Go looks great except for this glaring exception.

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

#140

I keep hearing about go. I am new-ish to programming. Only really getting started on my first project, which depends on pyparsing, which depends on other things. Is go something a novice should be attacking real-world problems with?

it depends on what your goal is.

A language is just one tool in your toolset. I love using Go very much, but I would recommend learning on Python. There's much more literature out there, more people you know will know it, and if you are looking for work, there are effectively zero entry-level programming jobs in Go.

The reason you keep hearing about Go is that it just very recently hit its 1.0 release, so it it a comparatively new language, and it's just a topic of conversation. Talking about Python isn't really newsworthy in the same way, because for most people, it's just a fact of everyday life. Go, however, is this new thing that's a little mysterious, that most people haven't tried yet.

Have you ever heard the phrase "you can never really know yourself until you know others"? Well, that's true of programming languages, too; learning new languages can help you to write better code in a language you were already familiar with. Learning new languages is great practice for any programmer.

But to start, I would just stick with Python and write some things that make you happy. That's the most important part; to figure out how to use code to make yourself happy. Which language you use is really just an implementation detail.

Post reply on HN