Live data from Hacker News

Why we switched from Python to Go

getstream.io

261–270 of 406 posts

Re: Why we switched from Python to Go

#261
post #224

Earlier quoted context omitted.

Can you point a clueless (about Java web dev) person to a nice, lightweight framework that's easy to learn and to set up? Please no XML configuration files and other such nonsense. For me as a Python/Rails/C++ dev Java has a reputation of being too large, too complex and otherwise.. unwieldy. Hearing things like "To test a bug I had to start 6 services on my computer and then I ran out of memory (computer had 16GB)"…

How much of a framework do you want? These days, i write most of my applications using the JDK's built-in web server. They're intended for internal use by single-digit numbers of people, and it works fine. It doesn't give you anything except the ability to serve HTTP, though. Before that, i was writing apps using Spring Boot, which is a framework covering pretty much everything. It's easy to get started with, and req…

I want an orm, a template engine, form validation, sessions and some authentication mechanism. I'm currently doing a system for a robotics competition - team registration, match results entry and point calculations, rankings and so on. Doing it in Python and Pyramid is quite easy, though sometimes I have to fight with the framework to do things the way I want to.

One especially useful feature in Pyramid (and some other Python frameworks, Flask, Django etc) is the debug console, when I get an exception somewhere, then on the 500 page I can see the call stack and get a shell at each line in the calls stack, print the variables, view the last n requests, see the request variables and so on.

Re: Why we switched from Python to Go

#262
post #190
post #183

Wait just one minute, Thierry... Are you telling me that Python helped you create a viable tech-oriented newsfeed and activity stream business, serving 500 companies and more than 200Million "end users"? That sounds like a great incentive for any entrepreneur to get started with Python. You've gotten this far by using the language you've turned away from! Further, I'm confident you didn't solve every challenge you've…

Hi, Jelte from Stream here. The post was definitely not meant to indicate that people should stop using Python. We still use it happily for the website and I'm still a big fan of it myself. However, for the API we've outgrown it in performance requirements. That's what the article is about, together with the things we found during the switch that we liked and disliked about Go.

I would love to hear your experience in two years though. I find the go runtime incredibly lacking in terms of introspectability. That's okay if you run google scale operations where you just throw away the environment on deploys and you do not care about the individual processes, but if you are running a reasonably lean operation the ability to see what a process is doing is incredibly helpful. That even affects simple things such as error reporting which is almost useless in Go to debug issues at runtime.

Re: Why we switched from Python to Go

#263
post #91

I'm surprised to see Go's error handling listed as a disadvantage. Go encourages writing good error messages, and that's one of my favorite things about the language. To get a sense of it, take a look at a failing test in a language such as Python that uses asserts for testing and compare it to the equivalent written in Go. Quite often, the error message in Go will be clear and to the point. On the other hand, I've s…

> I'm surprised to see Go's error handling listed as a disadvantage. Go encourages writing good error messages, and that's one of my favorite things about the language.

The biggest reason for me is the inability to get stacktraces to where an error comes from.

Re: Why we switched from Python to Go

#264
> Go forces you to stick to the basics. This makes it very easy to read anyone’s code and immediately understand what’s going on.

I think all new language design must incorporate this goal going forward. It’s been simply too valuable. When I see something introduced that does x, y incrementally better but makes no effort for the above goal I get sad and move on.

It’s easy to get caught up in the technical challenges of a language, but this meta challenge is what really helped move the ball forward with Go, and I’d love to see it introduced as a first-class goal in new language design.

Re: Why we switched from Python to Go

#265

Earlier quoted context omitted.

Most of the time, runtime speed is far, far less important than developer speed.

Speed and memory usage don’t matter until you need to rent servers on AWS

At which time you beat 95% of the pack and you should be grateful that your current 'slow' language brought you where you are.

Re: Why we switched from Python to Go

#266

Earlier quoted context omitted.

This is possible in Go right now. Use "if thing, err := blah(); err != nil { ... }". This is common for things like map access. See an example here https://play.golang.org/p/P3k5tgFLd2

Wait! Is this a go 1.9 thing? I've been using 1.83 all this time.

I don't think it's a 1.9 thing - I've got code from 2017-02 which uses it (the quickest example I could find in my repos)

Re: Why we switched from Python to Go

#267
post #233

Earlier quoted context omitted.

facebook, php ∎

and they are now seem invested in Ocaml/Reason (which are a lot less popular compared to Go) i guess after companies reach a certain size, they can go beyond choosing a programming platform for its ecosystem

Are they using much ocaml on the backend? At facebook's size they have a whole lot of different languages in the stack. I'd be very surprised if a significant portion of new backend development were in OCaml though.

Re: Why we switched from Python to Go

#268
post #145

Earlier quoted context omitted.

py.test does the magic walking, and it does indeed make for much less verbose tests -- no need to remember which self.assertSomething method to call either: x = 1 y = 2 items = [4,5,6] assert (x+y) in items Outputs this, replacing the variable names with values test.py:4: in assert (x+y) in items E assert (1 + 2) in [4, 5, 6]

If you aren't using pytest, you don't know what your missing. It cleans up so much of the testing boilerplate for python.

Though the magical global dependency injection is still somewhat obtuse, and not overly new-team-member friendly

Re: Why we switched from Python to Go

#269

> Go forces you to stick to the basics. This makes it very easy to read anyone’s code and immediately understand what’s going on. I think all new language design must incorporate this goal going forward. It’s been simply too valuable. When I see something introduced that does x, y incrementally better but makes no effort for the above goal I get sad and move on. It’s easy to get caught up in the technical challenges…

I think it depends on the use case. For individual component programming, sure: pick a hammer and make everyone use it. But for systems programming, being able to be multi-paradigm is a huge benefit. TIMTOWTDI ;)

Re: Why we switched from Python to Go

#270

Python was my entry into the programming world, and I've been an evangelist ever since... Or I was until I ran into distribution and parallelism. Since then, Nim has been my go-to language of choice. It is all that Python was, plus unbelievable speed, compiling to shippable binaries, and some other cool language features that admittedly, are still beyond my scope of abilities. Still quite lacking in libraries compare…

> Since then, Nim has been my go-to language of choice.

Out of curiosity: You use Nim professionally? Do you work for a company? What kind of software do you make? And what sort of people or organizations are your customers?

Post reply on HN