Live data from Hacker News

Python Is Easy. Go Is Simple. Simple != Easy

preslav.me

201–210 of 313 posts

Re: Python Is Easy. Go Is Simple. Simple != Easy

#201

Earlier quoted context omitted.

> a dozen different implementations of functions like "minimum" or "filter" this is too real and my number 1 gripe with go

And it's funny because go has a whole http server in the standard lib, but not minimum?

I know it sounds funny, but I have used the built in "net/http" in probably fifty projects now, and not a single one of them needed a min/max function.

Re: Python Is Easy. Go Is Simple. Simple != Easy

#202
post #153

Yeah, but the amount of boilerplate one must read and write in Go is frustrating, even compared to Java.

Java boilerplate is way worse AND hidden behind annotations and so many level of abstractions!

That's mostly a facet of frameworks like Spring, not something inherent to Java itself.

Re: Python Is Easy. Go Is Simple. Simple != Easy

#203

The sad thing is that many people make language decisions on the beginner topics like syntax , literals, hello world or trivial samples. Sure a 20 line python app will be 40 lines in Golang, but that doesn’t mean 10k lines of python are 20k lines in golang. And there are way more serious considerations than LOC. Golang concurrency is amazing. You can reproduce an entire multi-core application stack with concurrent IO…

My experience translating a codebase from Python to Golang (chat application), is that 20k of Python really does translate to around 40k of Golang to get the same functionality. And it’s not just due to language but also expressiveness of the library ecosystem.

I don't have any concrete measurements, but I think this is about right, ± a bit depending on the type of application.

I don't think this is necessarily a bad thing though; Go is a bit more explicit on a number of things and there's less opportunity to make code 'dense'. Both have their own up- and downsides.

Re: Python Is Easy. Go Is Simple. Simple != Easy

#204

Earlier quoted context omitted.

I think the key question is how robust a type system can be while keeping compilation extremely fast. Slow compilation absolutely destroys developer productivity.

You can make it pretty darn robust! OCaml compiles very quickly and has a good type system. Rust is slow due to LLVM, macros, and the compilation unit being the entire crate. None of these are requirements for a good type system

Zig's new compiler is a nice example of how you can do all sorts of inherently slow things at compile time and still have a lightning fast iteration time for developers if you design your toolchain for incremental compilation instead of making the compilation unit be the entire module the way Rust did.

Re: Python Is Easy. Go Is Simple. Simple != Easy

#205
post #135

Earlier quoted context omitted.

I can understand why you felt the need to share that, but if you only used it for about a day, aren’t you just reporting your initial impressions? If I used Rust for about a day, I would probably complain about the borrow checker. And if I used Python for about a day, I would have no idea what people are talking about when they complain about package management in Python.

It's pretty clear what the payoff is for the investment in using a borrow checker, and it's quite big. Less so for writing if err != nil on every. other. line. That's just an unnecessary nuisance.

The payoff is the same: you do more work up front, but have fewer weird, hard-to-track-down bugs later. Even rust's "?" operator nudges you towards "just pass the error on up", rather than actually thinking about what you want to do if an error happens each time.

Re: Python Is Easy. Go Is Simple. Simple != Easy

#206
post #180

Earlier quoted context omitted.

I think the key question is how robust a type system can be while keeping compilation extremely fast. Slow compilation absolutely destroys developer productivity.

Yep this is one of the reasons lots of my friends switched to Go: short compilation time (like good old Pascal days). Rust & Haskell is a big no :p

But we're not talking about replacing Go with something like Rust or Haskell here. We're talking about really basic, inexpensive things like not repeating Tony Hoare's billion dollar mistake yet again. Or actual structured error handling instead of something that's ergonomically quite similar to classic C-style error handling aside from the relatively incremental improvement of not relying on global variables.

Re: Python Is Easy. Go Is Simple. Simple != Easy

#207
post #37

Earlier quoted context omitted.

I used Go for many years. My issue is that it's _almost_ a great language, but in its current version it's just a collection of foot guns that makes it difficult to get shit done. Go doesn't have some of the most library functions, so large codebases shared between teams end up with a dozen different implementations of functions like "minimum" or "filter". Good luck debugging a bug in one of the implementations. The…

Go doesn't have some of the most library functions, so large codebases shared between teams end up with a dozen different implementations of functions like "minimum" or "filter". Does https://pkg.go.dev/slices#DeleteFunc not work for you or do you need it to be called filter? It's there for maps too https://pkg.go.dev/maps#DeleteFunc

To be honest, I used to use Go before generics became a thing.

I'm glad that they implemented some basic library functions 10 years down the line.

Re: Python Is Easy. Go Is Simple. Simple != Easy

#208
post #33

And Clojure has "Simple made easy" [1] [1] https://www.youtube.com/watch?v=SxdOUGdseq4 -> on of Rich Hickey's best talks

I wonder why isn't Clojure more popular.

I tried to use Clojure a few weeks ago. I have two projects for it: the first is that I have a "TOML test matrix" where I compare different TOML implementations against the test suite. This works by feeding a binary a TOML document which then outputs a description of that in JSON. I set that up for a whole bunch of languages.

The second is instaparse, which I'd like to use to quickly test a TOML document against the TOML ABNF.

I couldn't get either to work. As in: I can't even get very simple examples to compile. The tooling is super confusing and weird. I appreciate that a lot of tooling you're not familiar with can be confusing and weird, but I managed to get to a lot of languages for my TOML test matrix to work, including many where I'm not familiar with. For some that took some time and patience, but that's okay. Clojure is the only one thus far where I just gave up (for now anyway).

So at least part of the answer to "why isn't it more popular" is "the tooling isn't very good". Maybe the tooling is "simple" by Hickey's definition of that, but it sure isn't "easy" by my definition, and in the end, "easy" does matter, especially for these kind of things.

Re: Python Is Easy. Go Is Simple. Simple != Easy

#209
post #159

I'm diving back into python after being mostly away for the better part of a decade having built high scale, highly available systems in Go during that time (including migrating several projects from python and perl to go). Being suddenly back in python is jarring. So much inheritance - abstract base classes and multiple inheritance via mixins, strange coupling in tests via over use of mocking and patching, and a rel…

I was thrust into a go project after a decade of python. The most jarring thing besides the 3rd party panics, was the idiom that nils are typed. This was different than python, java, JavaScript, c, c++, etc. Variable loop scoping is also weird. Writing unit tests is 10 times harder than python. Go statically links everything, and just that seems like going back 30 years in software development. Any security in a depe…

Python has complex mechanisms to avoid depending on "whatever random stuff is in /usr/lib/python$v/site-packages" like pyenv and whatnot. Clearly that approach comes with a lot of downsides, too. Most newer languages avoid this pattern, including Rust, Zig, and probably others, and languages that don't tend to have workarounds; e.g. npm, bundle, etc. all use a "local" installation by default.

And while security problems are of course still a thing, there are a lot fewer of them than in C. Even in C it's not as bad as in "buffer overflow of the week" like in the 90s. It's that argument that's 30 years out of date.

Re: Python Is Easy. Go Is Simple. Simple != Easy

#210
Go isn't very declarative. The thing that always gets me with go is how much stuff has to be (or is culturally) imperative code. This isn't article isn't wrong, simple things arent easy and easy things aren't simple. But saying one is better than the other is not right either. Turring machines are simple but we don't use them for anything serious cause it's WAAAAY to difficult to make anything worthwhile.

It's been a while but golang keeps making simple is better decisions that hurt the language and ecosystem.

Sure, saying just download a dep from git is simple, but it doesn't work. It makes the whole ecosystem fragile.

Sure putting all your deps in a global folder is simple but it means you have to have a tool to manage envs and swap them out anyway to be able to write more than one app.

Simple != Easy but neither of them equal good.

Post reply on HN