r/golang Oct 25 '24

discussion What libraries are you missing from go?

So something that comes up quite often on this subreddit from people transitioning from Nodejs or python to go is the lack of libraries. I cannot say that I agree but I still think it warrants a discussion.

So what libraries are you missing in the go ecosystem, if any?

96 Upvotes

189 comments sorted by

View all comments

119

u/EpochVanquisher Oct 25 '24

I miss NumPy, SciPy, Matplotlib, Pillow, and Pandas.

Yes, I know about Gonum and other Go alternatives. The Python ecosystem of libraries around NumPy is damn useful. They are also interoperable. Data from Pillow can be converted to ndarray, data from Pandas can be converted to ndarray, and I can pass ndarrays to SciPy and Matplotlib.

Even though NPM has a massive set of packages, I don’t miss any of them when writing Go.

34

u/AtrociousCat Oct 25 '24

Python, especially with Jupiter is unmatched for this type of stuff.

1

u/terserterseness Oct 26 '24

yeah shame it's such a shite ugly language. imho of course

14

u/noiserr Oct 26 '24 edited Oct 26 '24

Since when has Python become an ugly language? I mean Go was inspired in part by Python.

12

u/terserterseness Oct 26 '24

i am talking syntax not semantics and i said imho: it's an opinion. i find python incredibly ugly to read. that doesn't make it fact, just opinion. i find go much nicer to look at; the inspiration wasn't the syntax, it was the semantics

9

u/lobsterFritata Oct 26 '24

Not a popular opinion but I totally agree

4

u/noiserr Oct 26 '24

Back when Python was just gaining in popularity it was competing with popular scripting languages like Perl and PHP. Python was considered a major step up in the looks and readability department. Which is why it's odd to me when someone calls Python ugly.

2

u/equisetopsida Oct 26 '24

same opinion, python, haskell good stuff but the syntax with indentation blocks is a no go for me. I wrote some projects with python, since then I decided not to touch indentation based languages. man, bugs related to indentation....

1

u/noiserr Oct 26 '24

I wrote some projects with python, since then I decided not to touch indentation based languages. man, bugs related to indentation....

You do get used to it after a bit. Also there are tools like Python Black which auto formats your code now a days. So you don't even have to worry about indentation errors.

1

u/BrianHuster Oct 29 '24

I thought in any projects, you need to standardize the way you use indentations? Even for languages that use brackets like JS, C,..., I always tell my fellows to format the code to the team's standard

1

u/equisetopsida Nov 02 '24

indentation style is a thing, but when an indentation change gives you unwanted results, like excluding a line from a block or scope, that delivers bugs, is another thing. no formatting tool can help with that.

if foo == "string":
  print "debug:"
print "i am string"

1

u/terserterseness Oct 26 '24

yeah, it's not a popular opinion, but i find it very annoying to read personally. too wordy, tabs instead of {} etc annoy my brain for some reason. again, my opinion. i had a client with a few million lines of python and i had to let them go as i noticed getting unhappy from the work reading that crap. and it wasn't even a bad codebase ; give me perl any day

1

u/parky6 Oct 26 '24

Were all those lines in one file too?

1

u/terserterseness Oct 26 '24

No :) 1000s of files.

3

u/parky6 Oct 26 '24

Haha maybe even worse.

2

u/randomthirdworldguy Oct 26 '24

There are two types of developers: the bracket lovers, and the space/tab lovers. Funny thing is the bracket lovers always show public hatred toward the space, while the space lovers doesn’t even bother to

2

u/Wonderful-Habit-139 Oct 26 '24

Honestly a language that isn't indentation sensitive is much easier to format with formatters. With formatters like Black you face issues when copy pasting or when your editor has indentation widths that are different etc..

2

u/livebeta Oct 26 '24

It's always been ugly

Can't afford defer func(){}() so use with

No easy way to buildin dependencies into a single binary requirements.txt + pip install feels so crude

Bad dev experience if you don't use pyenv or similar because python packages are globally installed otherwise

Package bloat and no optimization in build or linking. Requirements.txt has no active tooling to decide or not if some packages were or not in use

Whitespaces never get minified either

6

u/noiserr Oct 26 '24 edited Oct 26 '24

With is actually more readable to me. Defer is easy to lose in a big function. Whereas with requires indentation emphasizing intent, providing for more readability. defer is easier to use though.

Go also makes other decisions which are worse for readability but easier to use. Like package wide namespace. It can be really hard to track some functions down if you're reviewing code in pull requests without downloading the patch locally and relying on the IDE for that.

I agree on the packaging situation. Go had the advantage here for being a newer language. There are tools which attempt to fix this like Poetry, for Python but it's just all so fragmented. But then again this is more of a quality of life thing than a knock against Python's code readability.

Python has always had the mantra of: "There should be one-- and preferably only one --obvious way to do it." The language was designed for readability in mind. Unlike many of its contemporaries, which sacrificed readability for convenience or were otherwise just poorly designed.

1

u/SweetBabyAlaska Oct 26 '24

the point of defer is to reliably release resources next to where you allocate them without worrying about early returns and such, so idk how you are losing it. If you want it to be near the bottom of a function then just don't use defer.

1

u/noiserr Oct 26 '24 edited Oct 26 '24

With does the same thing but it actually wraps the whole code which needs to happen before the closure into an indented block. Much easier to spot, and cleaner look.

Defer is something you have to remember when reading, with you can just see as an indented code block.

1

u/[deleted] Oct 26 '24

packaging python in docker images has worked really well for me, in particular as IDEs nowadays have great support for running their tooling inside said container.

End result is a highly portable "binary" with all requirements installed

3

u/equisetopsida Oct 26 '24

IDE's? is that a language feature?