Python is great. I've been using it for 15 years now, and since then it has evolved from a niche-solution to the most popular programming language of the planet. It is being used massively in Data Science, Machine Learning, Web Development and automation.
The main advantages are ....
But still, some aspects of Python are just annoying. I collected my personal list of shortcomings - but beyond just complaining, I also complement them with benefits, alternatives and songs of praise.
1. Global Interpreter Lock (GIL)
Coming from other languages and having experience in multi-threaded programming, the Global Interpreter Lock probably will make you feel tempted to smash your head against the next wall. Indeed, in the age of multi-core computers and especially for applications as Data Science, where you typically want as much performance as you can squeeze out of your computer, this feels outdated and not state-of-the-art.
Alternatives
There exist a whole lot of ways to mitigate this issue. Ranging from obvious choices in the standard library like multiprocessing over dedicated packages like joblib to fully-fledged parallel architectures, you will find a way to speed up our good old snake. I'm working on a separate article for that, so stay tuned.
2. Why do I have to put self everywhere?
When writing classes in Python, we need to put self in every method declaration. This is definitely annoying, and also error prone.
Alternatives
Actually, no there are no alternatives. Just deal with it.
Beyond this, Python is flexible in terms of programming paradigms, so maybe you should stop writing classes or at least use OOP where it makes sense - and not beyond. that.
3. Why are Loops so slow?
The little word for is almost equal to long runtimes. Obviously not for dozens or hundreds of items, but when it comes to millions or nested loops, go grep some coffee.
Alternative
Whenever possible use libraries that push down loops to faster programming languages. Sums or products of matrices in Numpy are fast, most (but surely not all) operations in Pandas work like a charm. And to go beyond that, you can embed Rust code.
4. Why isn't there one single package manager that just works?
Python has pip, which makes it easy to install third-party packages. Until is doesn't work out of sudden. Then the pain begins.
Alternatives
Too many! You can use conda, poetry, pipenv. You name it. Whenever a new one pops up and claims to solve this issue, don't be too optimistic.
5. Runtime errors are common
Python is an interpreted, dynamically typed language. Duck typing is very useful - but also comes with the downside that quite some errors can only be found during runtime. If you are using both Rust and Python, you can feel the difference.
Alternatives
Write Tests! When reliability is a topic for your code, make sure it behaves as intended via unit tests. Just having type security isn't sufficient, so in the end, you need tests anyways.
By the way: have you ever tested to have ChatGPT write the unit tests for you! This can give you a massive speedup and find your blind spots.