I'm sad with Python
Before actually starting this I want to say that programming language discourse is 99% of the time based on subjective experience. The writing here is my subjective experience dealing with Python. Python may be good for you, or bad for you, or whatever. Replacements beware.
Time changes, people change
I've started learning Python after attempting to learn C but failing back in approximately 2013. But I would only consider writing Python for internet-facing production in 2017.
This rant has hindsight bias, for sure. But a good point on Python is that I didn't quite knew how to program things before learning it. Sure, I did write massive if chains with C but nothing more complex because as soon as I started reading the pointers chapter I would get confused.
Nowadays I'm not that confused with C pointers, or the difference between the stack and the heap (thanks Zig), and I'm a different person, with different goals and needs on what I want my software to be, or, what its principles are. But, even though I'm a different person, I'm still locked in to the younger me with Python, and now that I can put “5 years of experience writing Python” on my CV, I don't think this will go away any time soon.
A non-exhaustive list of things that keep me sad while writing Python
I could go on and enumerate things I'm not happy with and that I ultimately don't have power to fix, so here we go:
- Typing is sad, it's both a mix of giving static type checking but without actually breaking the language. I mean, yes, typing is good, but in the end you can declare a function that takes an int and give it a string and you'll only know something is wrong at execution time if you don't have
mypy
, and so you go to installmypy
, and then it doesn't find some library, or a library doesn't have typehints, or it decides to never want typehints, etc, etc, etc.- A subproblem of typing is using things like
typing.Protocol
. Which I tried to use, once. It type passed afterwards, but I feel dirty after writing something like that. I wish I could elaborate further on why, other than that general description of “something's wrong” while looking at it.
- A subproblem of typing is using things like
- Packaging. God. Packaging. After going through
requirements.txt
,setup.py
,poetry
,dephell
,pipenv
, I just gave up and settled onsetup.py
since it's the only guaranteed thing that might work. - Not being happy with the “large” frameworks AKA Django, meaning I have to go to things like Flask, but then there's
asyncio
, so I'm going to Sanic, then sanic is it's own hellish thing, and I'm now comfortable on Quart. And by using a niche of a niche of a niche web framework, I'm having to create my own patterns on, for example, how to hold a database connection by just puttingapp.db = ...
on@app.before_serving
, you can be suremypy
does not catch anything about that at all. Love it. - A Bug in a completely separate part of my software was caused by a bump in dependencies but not bumping my python version on CI. I kept banging my head for hours until I gave up and updated from 3.7 to 3.9.
- Endless language constructs seem to be the norm now. I don't like that we now have 4 different ways to merge dictionaries together, because the existing one didn't have “a good syntax”. That feels like a really low bar for “new” language constructs.
- This is new on 3.9, so its likely the two last entries are more of rants than critiques, idk.
The future?
I don't know. None of those things look like will ever be fixed. I'm seeing if I can write webshit with Zig, but that's all experimental. Might take much, much longer to “ship” but I feel that by not having the ecosystem or an interpreter slowing me down I'd have a better development experience.
I can't deny that I'm now with years-long experience with Python and I have to put something in my curriculum, though.
The tech industry makes me sad.