News for hackers. Stuff that matters.
Re:Why We Switched from Python to Go (2021) by KaiserPro on Thursday May 26, 2022 @12:14PM (#31520152)
As with all of these posts, the big reason is never really written:

"I just wanted to learn a new language"

Now, the points they've made are valid, Go concurrency beats the pants off python, and with gofmt, there is less of a debate about style.

Te bit about finding a team is pure horse cock. As they point out there are a bunch of C++/C programmers about. There are even more python programmers too. Go is a tiny pond compared to the big three (c, java, python).

Re:Why We Switched from Python to Go (2021) by tbarbugli on Thursday May 26, 2022 @02:07PM (#31521569)
co-founder and CTO of Stream here. I did not write the article but I was very involved with the decision process.

Your assumption is wrong, we did not pick a different language just for fun or because we wanted to learn something new :)

Python was just not the language we needed for our APIs, we tried hard to make it work but eventually we looked at alternatives that would allow us to keep things simple and performant. End result was better latencies, a much simpler architecture (less async/MQ work) and processes that would eat a fraction of RAM and CPU compared to Python.

Re:Why We Switched from Python to Go (2021) by distracted_boy on Friday May 27, 2022 @05:22PM (#31535082)
Are you using Go's http library or are you using some other framework?
Re:Why We Switched from Python to Go (2021) by throwaway894345 on Thursday May 26, 2022 @01:06PM (#31520813)
> Te bit about finding a team is pure horse cock. As they point out there are a bunch of C++/C programmers about. There are even more python programmers too. Go is a tiny pond compared to the big three (c, java, python).

If you can program in any language, you can program in Go. There's so much less to learn than even Python (perhaps especially Python when you consider all of the different packaging tools, testing frameworks, sync vs async, decorators, metaprogramming, etc).

Re:Why We Switched from Python to Go (2021) by tasuki on Thursday May 26, 2022 @02:52PM (#31522059)
> As with all of these posts, the big reason is never really written:

> "I just wanted to learn a new language"

Strong disagree. If the actual purpose was learning new things, they'd have chosen a language which does things a little differently than all of the mainstream. At least Haskell or some Lisp...

The fact they chose Go shows they care primarily about the practical side.

Re:Why We Switched from Python to Go (2021) by MathCodeLove on Thursday May 26, 2022 @07:55PM (#31524664)
They didn't say they wanted to learn new things, they wanted to learn a new language. I can want to learn how to drive a race car in addition to my Toyota Corrola without wanting to lear how to operate a crane (though that would be pretty interesting honestly).
Re:Why We Switched from Python to Go (2021) by tasuki on Friday May 27, 2022 @08:20AM (#31528686)
Where is the joy of learning a new language if not for learning new concepts? It just does not make sense to me. Learning a new standard library and build tools and all that stuff? Is that much fun?

People want to learn a new language for reasons: perhaps they want to learn new concepts, perhaps they want a language that's faster, perhaps they want a more mature ecosystem, perhaps they want to increase their employability. There aren't people who "want to learn a new language" as their ultimate end goal.

Re:Why We Switched from Python to Go (2021) by MathCodeLove on Friday May 27, 2022 @09:14AM (#31529212)
Maybe go is faster than any other language they've used? I'm not contending the fact that they have a reason for wanting to learn go as that new language. Just that your claiming they clearly weren't interested in learning since they didn't choose some esoteric language is fallacious.
Re:Why We Switched from Python to Go (2021) by tasuki on Friday May 27, 2022 @05:29PM (#31535153)
> Maybe go is faster than any other language they've used?

Quite possibly! That would be consistent with my point that they chose Go for practical reasons, rather than to learn for the sake of learning, as KaiserPro was suggesting.

If you want to learn for the sake of learning, you'll learn a different paradigm, rather than rehash the same thing with a slightly different flavour. Also probably your productivity will tank.

Re:Why We Switched from Python to Go (2021) by MathCodeLove on Friday May 27, 2022 @07:08PM (#31535969)
Can it not be both? Someone can want to learn for the sake of learning, and then filter further using practicalities. I'd love to learn every programming language out there, but it wouldn't be possible, we only have a limited amount of time in this life, so I'll instead learn the ones that are the most practical to learn. Java, however practical, may not be interesting to me so I may not learn it. Piet is super interesting, but not all that practical so I'll probably never learn it.

It doesn't have to be a single variable equation. I can learn something both to learn it and for practical reasons.

Re:Why We Switched from Python to Go (2021) by tasuki on Saturday May 28, 2022 @01:35PM (#31542160)
Yes it can very much be both! Or even more reasons, as you say.

The original comment I was replying to said their reason was "I just wanted to learn a new language", which is what I disagreed with.

Re:Why We Switched from Python to Go (2021) by MathCodeLove on Monday May 30, 2022 @07:56AM (#31558062)
Fair enough!
Re:Why We Switched from Python to Go (2021) by BobbyJo on Thursday May 26, 2022 @12:46PM (#31520542)
> "I just wanted to learn a new language"

and

> finding a team

Are connected. More people out there would be willing to work in Go than Python, even if more people know python. First, a large portion of python writers aren't backend devs, whereas pretty much all Go users are. Second, Python has a very bad rap as a backend language, and for pretty good reason. Third, if someone doesn't know Go, then can still get up to speed and use the language extremely proficiently within a few months, unlike any of the other languages you listed.

Re:Why We Switched from Python to Go (2021) by KaiserPro on Thursday May 26, 2022 @03:46PM (#31522591)
> if someone doesn't know Go, then can still get up to speed and use the language extremely proficiently within a few months

Which combined with a new code base is very stressful. but this avoids the main point, which is

> Python has a very bad rap as a backend language,

its not a front end language really(discounting the transpiled JS web stuff). I know people dont like it, and that's fair enough, but its as good as virtually any other language for "backend stuff". Its perfectly possible to write low latency high scaling code in python, just as it is in go and rust.

Despite what people say, code is just a logic brush, how you hold it, and how toy paint with it determines how pretty the picture is.

Yes there are inherent defects that each language has, but once again part of being proficient is know how not to blow your feet off. If Goethe can make wonderful prose in german, you too can make good scalable backend code in python.

Re:Why We Switched from Python to Go (2021) by BobbyJo on Thursday May 26, 2022 @09:08PM (#31525098)
> Its perfectly possible to write low latency high scaling code in python, just as it is in go and rust.

Depends on what you mean. A tiny and simple HTTP handler brought up on lambda, sure, Python will be as good as anything else. Anything larger than that, and no, it isn't. Python just doesn't have the semantics to do what Go and Rust can at scale. I run a service that uses 4 threads in Python and it's horribly slow and unreliable. I worked on a service in Go that used hundreds of concurrent go routines and it was reliable as hell.

> Despite what people say, code is just a logic brush, how you hold it, and how toy paint with it determines how pretty the picture is.

That's a great analogy when you consider painters use different paint brushes for different parts of the job.

> Yes there are inherent defects that each language has, but once again part of being proficient is know how not to blow your feet off. If Goethe can make wonderful prose in german, you too can make good scalable backend code in python.

Sometimes yes. But accomplishing the same in Go is so much easier I don't know why you'd bother.

Re:Why We Switched from Python to Go (2021) by kaba0 on Friday May 27, 2022 @03:42AM (#31527026)
> I run a service that uses 4 threads in Python and it's horribly slow and unreliable. I worked on a service in Go that used hundreds of concurrent go routines and it was reliable as hell.

That is very anecdotal to the point where I’m not sure it is all that useful. Go is supposedly good at parallelism, yet it has plenty of warts to the point where it is not at all more stable than any other mainstream language out there, so other than its pragmatism on channels, it really is not better than what you can do in Java or C#.

If parallelism is truly important for you than the actor model will be hard to beat in terms of reliability.

Re:Why We Switched from Python to Go (2021) by BobbyJo on Friday May 27, 2022 @07:46AM (#31528409)
Java didn't have a comparable thread/worker model to Go until this year, and arguably added it because of the success of Go routines for highly parallel services.

Also, go accomplishes the same with much less verbosity because it's the default operating mode.

So yes, you can do everything with Java that you can with Go (not true with Python) but it's a bit like using a semi-truck to commute.

Re:Why We Switched from Python to Go (2021) by kaba0 on Friday May 27, 2022 @10:50AM (#31530306)
Let’s not mix up virtual threads with the overall paradigm used for parallelism. Sure, on the former front Go was ahead for a time, but both are still pretty prone to race conditions and all the usual problems associated with parallel code.
Re:Why We Switched from Python to Go (2021) by smokey_circles on Friday May 27, 2022 @05:20PM (#31535063)
> it really is not better than what you can do in Java or C#

Theoretically, sure. If you _really_ know your stuff.

However, you can naively pack hundreds of thousands of go routines into a single thread in a go routine after a week or two of using it.

I'm not saying go is better, I'm just saying Java copied this abstraction for a reason: doing it right is hard

Re:Why We Switched from Python to Go (2021) by gkop on Thursday May 26, 2022 @12:18PM (#31520192)
For those of us not deeply familiar with Python vs Go, can you share a bit about why gofmt is so much better than the Python status quo (IE what’s wrong with autopep8 mentioned in article?)?
Re:Why We Switched from Python to Go (2021) by sliken on Thursday May 26, 2022 @12:39PM (#31520469)
Go has one, the same one used by the compiler, so there's no arguments, no multiple standards, etc. Python has a few options, and when a new language feature comes out the time to implementation may vary.

Think of it this way, if you could all the python code on github and ran it though autopep8, what fraction of the files would be changed?

Generally in the go community, contributions, patches, code, etc that's not formatted with gofmt is considered wrong/broken.

Re:Why We Switched from Python to Go (2021) by mountainriver on Thursday May 26, 2022 @02:57PM (#31522106)
It’s also an example of how Go thinks about all problems. Do things one way that is well made and roughly satisfies most use cases
Re:Why We Switched from Python to Go (2021) by kaba0 on Friday May 27, 2022 @03:42AM (#31527035)
(Other than Generics, which was known to be required decades before its existence.. sorry)
Re:Why We Switched from Python to Go (2021) by smokey_circles on Friday May 27, 2022 @05:28PM (#31535143)
required is a strong, but personal opinion. go's generics are just type switches for the lazy (over simplified)
Re:Why We Switched from Python to Go (2021) by gkop on Thursday May 26, 2022 @12:49PM (#31520579)
Thanks! More curiosity:

How do humans that disagree with the One Format deal with it? Do they self-select away from Go?

> Think of it this way, if you could all the python code on github and ran it though autopep8, what fraction of the files would be changed?

How does the format evolve over time as the community discovers improvements (if it does), and what are the implications for code on github?

Re:Why We Switched from Python to Go (2021) by sliken on Thursday May 26, 2022 @01:11PM (#31520871)
Generally I think most agree that gofmt makes pretty good decisions and it's better to have one format than competing formats that make it ugly when someone joins the team, or you are importing a library. The more you read code the nicer it is to have it all in the same format.

Like much of go, there's the "go" way to do it, and the language simplicity reduces the chance of multiple programmers taking multiple approaches that are all different enough to require wrappers to interoperate. Sure your pet feature from some other language may be missing.

The language (and gofmt) have evolved. In particular since the parser is externally usable (by gofmt, IDEs, and other tools) you can actually use that tool to rename variables, functions, etc without having to worry about getting a REGEXP right. So when there's the occasional incompatible change gofmt can parse code into a tree, make a transformation, and then back info code ... including comments.

It's relatively common (in my experience anyways) to have commit hooks in git run gofmt on go code. Generally go's been very compatible, none of the issues like Python2 vs Python3. I'm sure some avoid go for these reasons, but I lump them in with folks that reject python because of whitespace/indenting.

Re:Why We Switched from Python to Go (2021) by returningfory2 on Thursday May 26, 2022 @01:36PM (#31521176)
The point of view in Go is that the specific format is irrelevant. The design choices made by the format don't matter. What you think is "nice" code and what someone else thinks is "nice" code doesn't matter. The benefit of formatting has nothing to do with making the code conform to anyone's definition of "nice". It's just about having a format that's passable and that is then applied uniformly.
Re:Why We Switched from Python to Go (2021) by PeterisP on Thursday May 26, 2022 @01:21PM (#31520987)
If you disagree with the One Format, you can configure your IDE to show (or transform) the code in a different style while you're working with it, and have the One Format be the format for storage of the source.
Re:Why We Switched from Python to Go (2021) by theshrike79 on Monday May 30, 2022 @04:21AM (#31556695)
"Gofmt's style is no one's favorite, yet gofmt is everyone's favorite." - Rob Pike

This pretty much sums it up. Gofmt isn't perfect, but everyone uses it and deals with it. It's included with the language so there's no point in trying to create a "competitor".

Re:Why We Switched from Python to Go (2021) by snorfalorpagus on Thursday May 26, 2022 @12:28PM (#31520319)
I don't think there is a status quo. There is choice between autopep8, yapf (which itself supports 4 different styles), black, and maybe some more I'm missing. With languages that have a built in formatter this isn't an issue.
Re:Why We Switched from Python to Go (2021) by gkop on Thursday May 26, 2022 @12:39PM (#31520463)
What’s the material consequence of this lack of uniformity? When a new Python developer joins a team, is it painful or costly to accommodate their stylistic preferences? I see a single standard as a nice to have, but as long as the language has adequate tooling with reasonable defaults and quality linting, this just doesn’t seem like a big deal. Curious to learn first hand experience of those that switched from Python to Go…
Re:Why We Switched from Python to Go (2021) by prepend on Thursday May 26, 2022 @04:29PM (#31522992)
I’ve found it’s nice for detecting people who care about unimportant things.

I can’t imagine ever picking a language based on this feature and seems weird to even mention it.

This has never caused me a minute of headache and the only time I care is when conflicting styles are used in the same file.

I always thought it was kind of dumb of Go to care about this but don’t care enough to affect my language choice. I don’t use Go but am open if it’s a fit for a project.

I like that Python has that variability and let’s developer make decisions as they see fit.

I don’t want to talk to people about tabs and spaces unless we’re already friends and having a few beers.

Re:Why We Switched from Python to Go (2021) by gkop on Thursday May 26, 2022 @05:20PM (#31523506)
In candor I dabbled in Go in 2016 and found the community leaders arrogant and rude. I hope the community has evolved since then to expect more from leaders, but would need to see evidence of this before touching Go voluntarily again.
Re:Why We Switched from Python to Go (2021) by theshrike79 on Monday May 30, 2022 @04:31AM (#31556746)
I've used a good dozen languages and I don't know the "community leaders" of any of those.
Re:Why We Switched from Python to Go (2021) by BobbyJo on Thursday May 26, 2022 @12:48PM (#31520563)
The biggest issue I've felt with Python formatting is you run into build/versioning issues that basically never happen with gofmt. Also, some tools don't do everything you need, and you need multiple, like having to combine isort and black.
Re:Why We Switched from Python to Go (2021) by spapas82 on Thursday May 26, 2022 @01:03PM (#31520763)
Nowadays black is a defacto standard in python formatting.
Re:Why We Switched from Python to Go (2021) by throwaway894345 on Thursday May 26, 2022 @01:09PM (#31520836)
Black is awesome for the Python ecosystem, but it's still painfully slow for large files compared to gofmt.
Re:Why We Switched from Python to Go (2021) by Spivak on Thursday May 26, 2022 @01:26PM (#31521048)
How large is large because I don’t think I’ve ever even noticed black’s delay on 10k files.
Re:Why We Switched from Python to Go (2021) by throwaway894345 on Thursday May 26, 2022 @02:47PM (#31522018)
It would pause for a few seconds on 1-3kloc files on a fully loaded 2019 macbook pro.
Re:Why We Switched from Python to Go (2021) by philwelch on Thursday May 26, 2022 @01:52PM (#31521393)
autopep8 isn't deterministic enough. If you were going to autoformat your Python you'd want to use Black, which has the same philosophy as gofmt.
Re:Why We Switched from Python to Go (2021) by tech_tuna on Thursday May 26, 2022 @12:20PM (#31520224)
You down with RDD?