python is kudzu, let's plant golang instead
yes, crazy title, i know, but hear me out.
let me just start with my "pain points" of using python.
pain point 1: dependency management
here's a common scenario:
i make a script. its cool; im an avid uv
[1] user, dependency management is easy.
but my coworker doesn't. my coworker uses one of the other bajillion dependency managers. or, worse yet,
my other coworker uses raw pip and a requirements file. just freeballing it. im too lazy to package
their work for them, so i try and use pip. my keyboard catches on fire. hell takes me.
pain point 2: no static type checking
here's yet another common scenario:
i make a python script. it's neat.
my script requires some new features. not too bad, it's <100 lines, so not bad at all.
my script grows, and grows, and grows, until those 100 lines turned into 50k.
i make a change somewhere. all the tests past. i run the code. after waiting a few painful seconds
of startup, a big fat, threatening type error shoots my spirits dead. i wade through the various type
errors and the cycle continues.
explanation: python is kudzu
kudzu...is a group of...vines...[which] is invasive in many parts of the world.
the vine densely climbs over other plants and trees and grows so rapidly that it smothers and kills them.
-wikipedia[0]
i've been doing some learning about botany, and i've realized that python fits the description of an
invasive species perfectly.
see, python is the perfect scripting language.
i mean it. seriously. it's so low-friction to use; just write a script in a language that is basically
pseudo-code anyways. but it's structured enough to provide that complexity when you need it. it's not
bash; you don't have to deal with the weird-ness of a language meant for the shell, and yet it's ease of
use makes scripting in it dead-simple.
that ease of use has allowed python to "grow out of its garden", so to speak. while other languages
struggle to grow from a seed of an idea to a full bloom project, a python project grows faster than you can
blink.
and therein lies the problem. it grows so fast, that by the time you're ready to do some maintance,
you realize that the kudzu has taken over the whole forest. there's no structure, there's no ecosystem. just kudzu.
in non-metaphor speak, a python project tends to grow in such a way where the same things that allow
frictionless development become a detriment. no static typing is great when you want to rename some
files in a directory, but it sucks when you want to get rid of the easiest class of bugs through basic
static analysis. a global dependency manager is great when you're first scripting and want a library
to color text, but it becomes a major pain when you want to distribute your project. not worrying about
compiling is a joy, until you realize that your docker containers are half a gb due to needing a whole runtime.
an easy alternative: golang
i think golang is a nice alternative. its not as frictionless as python, but its growth is so much more
structured, in a way that lends itself nicely to "real" (aka non-scripting) projects.
pain relief 1: dependency management
i create a new project in golang.
i want a new dependency. i get war flashbacks from dealing with pip.
i realize that golang dependencies are automatically sandboxed per-project.
i let out a sigh of relief.
pain relief 2:
i make a change in my project.
automatically my editor figures out type errors for me. even without an editor,
i just build the project without running anything.
i breathe easy knowing that my project doesnt do any weird type-stuff. i avoid a whole class of errors.
life is good.
explanation: golang is a sycamore tree
(disclaimer: i've reached the end of my knowledge of botany).
see, unlike python, a go project tends to have more moderate growth. it's not as frictionless. but,
you trade some initial complexity with future gains. a go project tends to grow gracefully, and you avoid
so many of python's pain points.
you also get some added benefits:
- super tiny containers: since golang projects can be built into an executable, containers are tiny and easy to build.
- free performance: golang projects are almost as fast as lower-level languages, so profiling code to get speed gains is rare.
- easy tooling: there's only one linter, package manager, formatter, compiler, etc.
- easy concurrency: seriously, its awesome.
i could go on and on.
seriously, try golang, it's awesome. put python back in its garden and cultivate a real forest instead.
links
- [0]: https://en.wikipedia.org/wiki/Kudzu
- [1]: https://docs.astral.sh/uv/
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⢀⣼⣦⠀⠀⣠⣿⣿⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣆⠀⠀⠀⠀⠀
⠀⠀⠒⣿⣿⣿⠓⠀⠀⠻⣿⣿⠀⢀⣴⣿⣦⡀⠀⢀⣾⣦⠘⢿⣿⣧⡀⠀⠀⠀
⠀⢀⣴⣿⡿⠃⡄⠈⠻⣿⣟⣉⣀⠉⣽⡿⠋⠡⠴⣿⣿⣿⠓⠀⠙⢇⠀⠀⠀⠀
⠀⠿⣿⠟⢁⣾⣿⣦⣀⠘⠿⠟⢁⣼⣿⣿⣷⠂⣴⣿⣿⣿⣆⠘⢶⣶⣿⠶⠤⠀
⠀⣀⣀⡀⢉⣿⣿⣿⡍⠀⢀⣀⠙⢻⠿⢋⣤⣾⣿⣿⣿⣿⣿⣷⣄⠙⢿⣦⡀⠀
⠀⠟⠋⣠⣾⣿⣿⣿⣿⣦⣌⠉⠠⣤⣤⣤⡌⢙⣿⣿⣿⣿⣿⣿⠛⠛⠂⢈⣙⠀
⠀⠀⣉⡉⣹⣿⣿⣿⣿⣏⠉⣉⣀⣈⠙⠋⣠⣿⣿⣿⣿⣿⣿⣿⣆⠙⠛⠛⠛⠀
⠀⠀⠋⣴⣿⣿⣿⣿⣿⣿⣷⣌⠉⢁⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀
⠀⠴⢾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠦⠈⣙⠛⠛⠛⠛⠛⠛⠛⠛⣉⣉⠁⠀⠀⠀
⠀⠀⣦⣤⡄⢉⣉⣉⣉⠉⣡⣤⠀⠀⠀⣿⣿⣷⠀⢰⣿⣿⡇⢸⣿⣿⠀⠀⠀⠀
⠀⠀⣿⣿⡇⣸⣿⣿⣿⡄⢻⣿⠀⠀⠀⣿⣿⣿⠀⢸⣿⣿⡇⢸⣿⣿⠀⠀⠀⠀
⠀⠀⣿⣿⠁⣿⣿⣿⣿⡇⠸⠿⠀⠀⠀⣿⣿⣿⠀⢸⣿⣿⣇⠸⣿⣿⠀⠀⠀⠀
⠀⠀⠛⠛⠀⣿⣿⣿⣿⡇⠀⠀\o/⠀⠉⠉⠉⠀⢸⣿⣿⣿⠀⠿⠿⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠛⠛⠛⠛⠃⠀⠀/\⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀