Many Words on Subclassing in Python
Greetings friends!
I'm super excited that despite the fact that the last post was rather niche, y'all keep subscrib[ed|ing]!
Now if my SemVer post was flamebait, this one Death-Star-bait. And it's also very long. It started when I just wanted to properly type out a Twitter thread on subclassing in Python I've done some months ago and then it somewhat escalated.
The problem with writing any opinion-laden piece is that you have to write with the least-charitable reader in mind (although nothing will save you from stopped reading after X guys) and so my attempts at filling up holes led to more than 5,000 words. Obviously there are still holes and obviously they'll be found.
Interestingly I never planned on writing this article because I fully anticipate the knee jerks and reductive hot takes. And I've even procrastinated on getting it finally out. But as the kids say: it lived in my head rent-free and as trite as it sounds: it wanted to be written.
While it has some natural structure and I've been urged by multiple people to split it up, because nobody has the patience to read the same article for 20 minutes (TikTok video of me flossing while TL;DRing is in the works) and it's much better for engagement and sharing, I've decided against it.
Firstly, I want it to stand as a piece for itself like my idol Brandon Rhodes does in his Python Design Patterns. I want it to be complete. I don't want people to speculate about what I'll get wrong in the upcoming installment. I want it to tie together my decade of experience.
Secondly, the parts are not made equal. It would end up in very uneven parts and I don't want the temptation to lengthen or shorten any parts. If it's too long for your cup of coffee, feel free to take breaks and decided yourself where!
So here it is, my magnum opus, the plight of many weekends, and the longest thing I've ever written since my thesis in 2006:
It is Python-specific but I'm convinced there's plenty cross-language wisdom embedded.
My big hope is that you can read it with an open mind as something that you might learn something from even if you disagree with the premises. It's very likely that not all is what you expect!
Please share widely and let's hope I'll regret writing it a little less than expected. /o\
Best,
—h