Lachlan Harris
Switching from Python to C++

Switching from Python to C++

May 26, 2025
5 min read
Table of Contents

A couple years ago, I was tasked with creating a game based around the theme “stars”, using nothing but good ol’ pygame. And what did I decide to do with this theme? Make a falling sand game.

Gif of the game

I honestly loved making it. Python is most definitely the best beginner language, it’s incredibly versatile, and the syntax is pretty simple. But, there’s a little known issue with all versatile, simple-syntaxed, garbage collected languages, and it’s that they are slow as F#@%.

That’s why, despite being the language that most developers know, so few with actual work experience actually use it.

So I challenged myself to recreate this laggy mess of a game using the beloved C++, a language that I had never used before, heard so much hate towards, and yet felt so drawn to.

Who cares?

C++ is what many consider the “bare metal” programming language, and after using it for a short time, I can see why.

A Brief, Slightly Biased History

C++ descends from C, which in turn descends from assembly, which in turn descends from ritualistic byte incantation. It was designed to add object-oriented features to C while maintaining its raw, uncompromising performance.

Released in 1985, C++ is ancient by programming standards. It’s old enough to make you do your own memory management. It’s old enough to believe that if your code segfaults, it’s your own damn fault.

But it’s also powerful. It’s fast. It’s compiled to the metal. It’s used in AAA games, high-frequency trading systems, aerospace software, and anywhere else you don’t want a garbage collector randomly freezing your app for 5 seconds.

Why C++ is so controversial

I have a love-hate relationship with C++

Switching from python to C++ feels like I’ve just gone from wielding a comically large nerf gun to a freshly oiled butterfly knife, and that would be a welcome change… if I wasn’t cutting myself trying to look cool in front of the ladies.

There’s things to love, things to hate, and most of them collide from the exact same statements.

C++ does EXACTLY what it’s told to do

When coding with C++, I found myself adopting a much stronger “if it can go wrong, it will go wrong” mindset, which is good to have in a production environment, but it really drives you insane. I kept getting these errors I never knew could exist, like numbers becoming too large & causing an error that looked like a toddler bashed his head against the keyboard, all because I didn’t clamp the result of division.

But at the same time, it made me realise that the language was manually flipping individual bits like an abacus, and that satisfied my coder brain knowing the sheer performance it could achieve.

Much fewer resources online

While coding in python, or back in my days of Unity, there was so many tutorials online that entering the pits of tutorial hell was nearly inevitable every time I wanted to implement a relatively common feature / algorithm. It really did help streamline the development process of whatever I was building.

When I realised C++ really just had the occasional beginner tutorial for some either incredibly niche or incredibly broad project (Our saviour javidx9 having the most), it always made me open up my eyes realising that I would be the one creating this system for myself.

Don’t sit there thinking that I shouldn’t be relying on Ctrl C & V, I know you do too. But it really made me realise that C++ is genuinely a “late-game” language that you have to figure out yourself. And that is both a bad and a great thing.

Cross-platform? Good luck.

The thing that makes C++ so damn fast is that it loads only the absolute bare minimum code needed to run, which means no loading unnecessary overhead, no cross-platform capable compilers, and nothing but a raw binary.

It means that you need to choose all your dependencies wisely, recompile and relink for every target, and test it manually for every platform.

But this is the whole philosophy of the language, like why you’d choose a 90’s Toyota over a 2025 Kia


Final Thoughts

Rewriting my little Python game was like replacing a tricycle with a motorcycle and immediately riding it into oncoming traffic.

But along the way, I learned more than I expected:

  • How memory works under the hood
  • How to build systems from the ground up
  • How to debug segfaults using pure vibes
  • And how much performance is hiding under all that high-level abstraction we take for granted

C++ is brutal, but it rewards that respect with raw power and deeper understanding. It makes you a better programmer - through pain, yes - but a better one nonetheless.

And while I haven’t used it for every project since, it permanently changed how I write code, in every language.

Would I recommend C++ to a python programmer?

No.
Would I recommend it to someone who wants to understand why Python is slow?

Absolutely.