home   about   blog  
mastodon   github

Maybe I Don't Want to Use Python

Python is a great language - it's tooling, is not

Published on 2021-11-18

Recently, I stumbled upon yet another Drew DeVault blog article, whose articles I do enjoy reading, but this time his take was on Python, and how the tooling is a terrible experience all-around, and gives most people headaches. You can read his post here. It hits home in a couple ways, but soon after a switch kind of flipped on in my head after seeing some new stuff I wanted to try, and I thought to myself - do I really want to use Python?

A History of Python Experience

I have been using Python since I was a teenager, for well over half my life at this point. I started Python back when it was still Python 2.5, quite a few years from where we are now with Python 3.10 (or whatever the last stable Python3 was... I'm not keeping track). I have a level of comfort with Python. I have used it for games, data projects, GUI development using wxWidgets (which was awesome, love that library), website development using Django, and probably so many other things (like the time I made a Mandelbrot set generator which tweeted out images and occasionally made 3D renders using Blender scripting).

Python is nice to me, the ecosystem is cool. I went to a Python New York conference once, but didn't really get all that much out of it, was still a fun trip none the less. But after that trip, I kind of... stopped using Python. It's not really of interest to me anymore. That being said if a job required Python usage, I'd use Python! Cool stuff there. But I haven't had that experience yet. If anything Python is kind of looked down upon, and isn't even the "trendy" thing in many places now.

So what have I been using instead? Well that's easy.

  • Racket, my go-to language for all things coding
  • Zig, the new popular language I want to get better with
  • Rust, for when I need to get serious
  • C/C++, for Arduino's sake (I would like to experiement with MicroScheme)
  • Haskell, for my curious nature and joy of writing Haskell

These languages don't look anything like Python. For anyone who's a pro Python user, they most likely would hit up Ruby. I have written scripts before in Ruby, and I did find it decently enjoyable! It compressed a ton of lines of code compared to a Python program I had written to do the same task. I'm not against Ruby, I like the fun nature of it. It might make people's lives hell in many other categories, but Python can very easily do the same thing. Ruby at least appreciates functional programming.

Reasons Against Python

So briefly, let me say why I like these languages compared to Python.

  • Racket - Racket is a Lisp-family language going the way of MIT Scheme. It has support for functional programming, code expansion (macros), even support for object-oriented programming. It supports many styles of programming, and macros allow you to expand and create your own miniature DSL where needed, or wrap around code that you simply don't like at all. Python does not allow for modifying of the Python AST without having to go down into the Python C code, add new features, and then re-compile the binary. Therefore, the Python runtime is bogged down behind PEPs and loads of emails before it ever gets new language features.
  • Zig/Rust - both are languages I am starting to appreciate for their type-safety and compile-time SAT-solving features. Rust has many things Zig does not, where Zig has many things Rust does not. I am growing to appreciate Zig more and am always on the lookout for more Zig-related content. Python does not have features like abstract types or even the performance of either of these languages.
  • Haskell - I enjoy Haskell as a language because it is able to remove the burden of syntax-heavy languages and simplify it into expressions or functions that just make sense. No more for loops, everything is typed, everything is safely checked at compile-time, and the language has a lot of quirkiness that can be improved with language extensions. Python lacks a lot of the grace of Haskell.
  • C/C++ - I don't really have to talk much about it here. C/C++ is where people often times go when they need performance or need to go much lower. Python memory management can be hell for many applications.

So while I appreciate that Python is a slow-moving language that tries not to break things, sometimes it moves a little too slow. The new walrus operator is a boon to the language for a few reasons, like the ability to improve the language to accept abstract types and pattern matching, but the slowness is what drives people to look for innovation elsewhere.

Why should I force myself to be stuck on a language that won't add quality-of-life changes until years away? That doesn't sound healthy for a team of employees who are stuck writing what could be boilerplate code for an eternity. If a new language feature comes out, and it is a massive improvement and could save workers lots of time, I am definitely going to look at the work hours saved by new features as opposed to being religiously glued to some old archaic way of doing things.

Package Management += Python Versions

The package management aspect of Python is by far the worst offender of all, so much that it's an internet meme.

Does this happen to you? Because this certainly happens to many people. Source: [xkcd.com/1987](https://xkcd.com/1987)

Does this happen to you? Because this certainly happens to many people. Source: xkcd.com/1987

It is nigh impossible to tell what is going on under the hood of a Python environment. It's also not even in Python's best interest to tell you what goes on where and how - Python binaries are built into the operating system as a cool little thing to make users attracted to *Nix systems, but this is honestly a kind of trap. The system-included Python binary is often a disaster, because those libraries are stuck managed by the system's package manager, and good luck getting the packages you need up-to-date in a sane manner.

On my system, I have a Python binary installed, but it's old. I want the newer version, but the package manager does not have an up-to-date Python binary in it's repositories. So I need to look elsewhere - I need to do whatever it takes to avoid having to use that system one. I still want Python installed in my computer, but for specific projects that needs pinned versions for a deployment, I need to rely on third-party vendoring tools like Docker, Guix or Nix to even create a sane way of doing things.

The fact that we as Python developers have to even rely on Guix/Docker/Nix/etc to get Python projects running is the real problem. Python isn't good enough on it's own to stand up to things like Golang. Go is able to pin versions of software, do git pull on pinned dependencies, do all the dependency SAT-solving, compile all the code, and create binaries for multiple architectures, and this process can happen all within a minute or so, give or take. Go is absolutely hurting Python in so many ways, and Python cannot do anything about it.

My "sane" way of doing Python is using Guix to download a (slightly older) version of Python and Python's pip tool, launch into an ad-hoc shell of this new environment, use pip to download the packages, and use these dependencies in my deployment. None of this sounds very Pythonic at all. In fact, I think Ruby's Gem system has a much better environment for working. Ruby allows you to manage multiple Ruby versions at once and swap between them as needed. To my knowledge, Python will never let you do this at all.

Without Python

I am happy that Python gave me the ability to become a better coder in life. I liked the language at the time, it existed when I felt that there were too many horrible things in computers, and especially did not enjoy C++ at all when I was a teen. Python was a breeze to use.

But however, I think I am moving beyond Python. I don't see any reason to continue using it in my personal future. I don't want to have to continue writing code that ends up requiring me to go through package dependency hell. I don't want to have to keep jumping hoops with virtualenv or Guix to get things working. I simply want a language that lets me exist and write code to actually do things. I don't think Python is suitable for large-scale projects.

In my upcoming Django project that I will not be talking about yet, I was using Python and Django. But after Drew's original post and my own thought process, I think I can do my next project without Python, actually. I don't really need an ORM, and I found a different service I would like to keep using and exploring. Therefore, I will not be using Python for this up-and-coming venture I have.

It was fun while it lasted Python, I wish nothing for the best for you, and maybe we'll meet again under different circumstances. I can probably still write an occasional line or two of Python, and teach people how to use you, but I think for me, I'm good for now. I like Lisp too much.

Steven Leibrock 2023 rss   home