Live data from Hacker News

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

preslav.me

141–150 of 313 posts

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

#141
post #65

Earlier quoted context omitted.

Ok, maybe you can help me figure something out that I haven’t been able to. I’ve got a project broken down into modules. Module A uses module B. These are both checked into GitHub, so the module path is something like guthub.com/distortedsignal/my-project/src/a or whatever. I need to make a change across both of these modules. Will my compilation pick up the changes? What if I need to make a backward-incompatible cha…

> I need to make a change across both of these modules. Will my compilation pick up the changes? Yes, add a replace directive to A's go.mod and point it to B's directory. It'll pick up changes immediately. You can also vendor + disable modules + change stuff in the vendor folder to quickly experiment, though IDEs tend to get moody about this. Backwards incompatible in principle: release a new major version of B. Impo…

> Yes, add a replace directive to A's go.mod and point it to B's directory. It'll pick up changes immediately.

Nowadays you just create a go.work file. That's much less cumbersome than 'replace' directives.

If a module is in the go.work it isn't downloaded from a remote git repo, but overshadowed by your local files.

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

#142
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 and CPU in a single binary.

When you realize how much code is wasted on config, RPC, encode-decode, code-generation, concurrency & locking – you want a language that reduces the need for those things (or makes them really easy).

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

#144
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…

This roughly lines up with my feelings. Go is a solid improvement over many languages that we inherited from the 70s, 80s and 90s. But it also retains a certain "we don't need a robust type system; weak-ish static typing is good enough" ethos that made sense in back then, when compilers were hard enough to write that it was easier to justify making the programmer handle more things manually for the sake of simplifyin…

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

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

#145
post #67

Earlier quoted context omitted.

I tried Go for about a day, and the exception handling and null-pointer issues were exactly the things that made me lose interest.

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.

That's true, but the flip side is selecting heavily for public commentary from people who are already invested in—or at least generally open to—the tool in question. But, of course, that means selecting heavily against the people who see immediate, significant problems!

I've run into this problem repeatedly on Goodreads where wholly mediocre works get high ratings because of aggressive selection bias. I generally like fantasy, but I've stumbled on some painful stinkers thanks to this dynamic.

It's doubly reasonable to value first opinions on languages like Go since they intentionally aren't doing anything fundamentally novel. With a handful of exceptions, Go is a remix of ideas from mainstream languages that we've all seen before. It is about as far from a new paradigm for programming as you can get, and that's the point! Hell, that's the main thing people praise about the language: "I could pick Go up immediately, without needing to learn anything new"...

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

#146

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…

Python code typically doesn't and shouldn't rely heavily on inheritance. It sounds like you're working on non-idiomatic Python code. Bad luck.

Do you mean that the hierarchies don't tend to be very deep in Python? I don't tend to have deep inheritance hierarchies in Python, but I don't tend to have that in really any language I use. If you mean Python code doesn't tend to use inheritance in general, I'm not sure that's true. Django, DRF, the ML/DS packages, etc. all seem to use inheritance as much as any other language...I think? Maybe you're contrasting to those endlessly deep hierarchies you might find in Java? Otherwise, I'm just not sure what the basis is for saying you shouldn't rely on inheritance in Python, given that it is a first-class citizen due to its object-oriented programming model.

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

#147
post #5

No matter what your opinion is about Go (as a language), but they nailed it for bigger projects. Go code always looks the same, performance is predictable and fast enough for most programs, and its really, really easy to be productive. When i picked up Go i basically got shit done without ever having written a single line of Go. Its statically typed (with generics yey!) and compiles very fast. Its easy to create smal…

Don't forget the fact that it doesn't have this overbloated concept of inheritance and polymorphism of let's say Java where you have to look through 6 files to understand what's even going on. Even generics in Go were a heated debate because they make the language more complex. All in all Go was created by geniuses and it shows.

Go was first and foremost created to serve the needs of Google. Kudos to them for releasing, open sourcing and backing it but it was designed to serve their needs. It’s not a criticism but it explains why it’s quirky in many areas. The authors being genius is not as important as the goals and intentions.

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

#148
post #140

Earlier quoted context omitted.

mostly joking - your complaints are big problems in python. Dependency management in Go has been contentious (historically) with "to vendor or not to vendor", glide and dep, GOPATH, etc. But that is all solved. Go mod for the win. As far as "the nightmare of {using interfaces}" -- I have no clue to any controversy there. It is one of the most celebrated features of Go. Not sure where you were going with that. In Pyth…

The Python typing nightmares you refer to go away on large projects as soon as you start using mypy, which I tend to find most large projects do these days. So yes, you can change that string and you do know. It's still better that it's optional and gradual - it's unnecessary overhead on smaller projects, spikes, notebooks, etc. which are what most big projects grow out of.

Python typing nightmares definitely do not just go away with the use of mypy. There are so so many ways to break out of the guardrails it supplies that are not caught.

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

#149

Python is valuable due to the ecosystem of libraries it offers. The language itself is extremely poor. I think this is not something most Python users are aware of since if you are doing ML, data-science or simple scripting there is little reason to step outside of the ecosystem. - Weird scoping rules - Very limited list-comprehensions - Ability to monkey patch things is a liability - Mutability by default - Lack of…

Python always felt well designed to me. Slow yes but it felt the the author really thought about how the language would go together. This is mainly a comparison to the other scripting languages available.

Pick your poison

  shell  #expand all the strings, but those pipes are nice, why can't more languages have pipes.
  awk    #not a bad language, but very very small, and an AWKward(see what I did there) implied data loop
  perl   #can do anything but the syntax is, well it is a real frankenstein monster of a syntax
  python #well designed syntax, has a strange block structure but at least it is always nicely formatted
  tcl    #all the strings! but other than that not half bad
  ruby   #pretty, but wow, that is a lot of magic
  php    #just graft on whatever to the language as you need it, don't worry about how it all fits together.
Post reply on HN