4 ms·
i dragged my feet on go for a long time. i also thought that skipping go and moving to rust was the play. a few years later, i still write python often, but i d
by nathants 4y ago
i dragged my feet on go for a long time. i also thought that skipping go and moving to rust was the play. a few years later, i still write python often, but i don’t build systems with it. python i now use like bash, to glue things together and automate random things. it’s a fantastic language and i will never drop it.
the verbosity of go is the biggest hurdle for a pythonista. the thought of giving up context managers, decorators, iterators, comprehensions, exceptions, coroutines, it’s unthinkable. in comparison go is ugly. your aesthetic mind screams in protest.
write go full time. dive in. as months pass, not only will those aesthetic objections fade, your mental model from python cleanly transforms to go. go is what mypy tried to be. the cost was aesthetic changes. the benefit is worth it.
the zen of python says if it’s easy to explain it might be a good idea. this is go, and it is.
i rebuilt a reasonably sized project from python[1] to go[2] over the last few years. i also have a system that i maintain both python[3] and go[4] implementations for, sharing a test suite in python. squint at the implementations. consciously ignore aesthetic objections. they are basically the same, not very different from a python codebase with and without type annotations.
go, like python, is fantastic. use both in whatever amount works for you. don’t read about them, build with them. you won’t regret it.
1. https://github.com/nathants/cli-aws/tree/bb78e529e7d1d3f95acc62dd0fbe21cadc822928 https://github.com/nathants/cli-aws/tree/bb78e529e7d1d3f95ac...
2. https://github.com/nathants/libaws https://github.com/nathants/libaws
3. https://github.com/nathants/s4/tree/python https://github.com/nathants/s4/tree/python
4. https://github.com/nathants/s4 https://github.com/nathants/s4
- jerf 4y agoObviously the closest thing in the general sense to Python is Ruby. But I think a case can be made that in practice, the closest thing to Python on the static language side is Go. The list of superficial differences is a mile long, I don't deny, nor will I exhaust my audience's patience with actually writing them out. But the interface orientation of Go captures the essence of how you design in Python surprisingly well. Of all the static languages, Go has the closest thing to duck typing, in particular the ability to declare a "duck type" for an existing third-party thing that you don't want to or can't change, and integrate it into your code as a compile-time checked member of that "duck type".
- nathants 4y agovery true! to be a WriteCloser[1], you have to be able to Write[2] and to Close[3]. quacking confirmed. 1. https://pkg.go.dev/io#WriteCloser https://pkg.go.dev/io#WriteCloser 2. https://pkg.go.dev/io#Writer https://pkg.go.dev/io#Writer 3. https://pkg.go.dev/io#Closer https://pkg.go.dev/io#Closer
- Redoubts 4y agoReally? Swift feels so much closer than this.
- vonseel 4y agoDo Go programmers also not like capitalization? Just a tease, I noticed the readme and your comment don't have any Capitalized Letters. Well, the readme has a few but you know what I mean.
- nathants 4y agoi can only speak for myself. i reserve raising my voice for where it's APPROPRIATE. as with the python/go debate, aesthetics are subjective.
- corrral 4y agoBreaking basic language norms in this way is the equivalent of CONSTANTLY RAISING YOUR VOICE. It's distracting and attention-getting. Which may be your goal, but if your goal is to be easily understood and sympathetic to your reader, it's counterproductive.
- nathants 4y agothis is exactly correct. i sincerely apologize to any who have been harmed, even slightly, by my oddity.
- jamal-kumar 4y agoI've rebuilt multiple projects written in python/php/perl originally in go instead and it's just great how much more performant these comparatively are... Just way lower resource usage and the programs work faster now. It's worth it to consider the switch. One of the things that go is really good for is the amount you can get done without having to deviate that far from the standard library. A lot of churn in updating code can be alleviated if you try to select small, well-written, well-maintained libraries in ANY language but in go this just feels way easier, I find myself thinking how to solve it using stdlib instead of trying to find out what package would suit my needs and boom everything is there already don't need to mess around too hard looking on whose shoulders to stand on only to have them walk away and do something else with their time down the line. The worst ecosystem for that is easily nodejs, blows my mind what front-end dev often looks like these days... like it being normal for a project's node_modules to hit like 500mb is just incredible to me. I'm extremely allergic to that mentality. Someone hit me up like hey I have a linux problem when i run webpack it crashes my whole system... like yo how does some corky javascript thing to minify stuff cause semaphore exhaustion to a point where your entire system goes down when you run it on a sufficiently large project, that's just horrifyingly bad. Found out if he was to continue using that tool that he had to install some graceful filesystem package for it to work. I think I managed to convince him to switch to esbuild, written of course in go. [1] [1] https://esbuild.github.io/ https://esbuild.github.io/
- nathants 4y agoi agree, performance and stdlib are very nice benefits. i enjoy refactoring with type safety and using gopls and ide completion instead of external docs. i used to constantly read boto3 docs in a browser, now i use gopls in my ide. frontend dev can be sane[1] too! my default setup is a go lambda with an spa frontend inlined into an html file. the lambda zip contains two files: - ./main - ./index.html.gz 1. https://github.com/nathants/aws-gocljs https://github.com/nathants/aws-gocljs
- jamal-kumar 4y agoI like TypeScript + deno [1] a lot these days for similar reasons... It's got the same thing going for it, a solid standard library on top of something like JS but sucks less. [1] https://deno.land/ https://deno.land/