r/Python • u/todofwar • Jun 03 '25
Discussion So tired of python
I've been working with python for roughly 10 years, and I think I've hated the language for the last five. Since I work in AI/ML I'm kind of stuck with it since it's basically industry standard and my company's entire tech stack revolves around it. I used to have good reasons (pure python is too slow for anything which discourages any kind of algorithm analysis because just running a for loop is too much overhead even for simple matrix multiplication, as one such example) but lately I just hate it. I'm reminded of posts by people searching for reasons to leave their SO. I don't like interpreted white space. I hate dynamic typing. Pass by object reference is the worst way to pass variables. Everything is a dictionary. I can't stand name == main.
I guess I'm hoping someone here can break my negative thought spiral and get me to enjoy python again. I'm sure the grass is always greener, but I took a C++ course and absolutely loved the language. Wrote a few programs for fun in it. Lately everything but JS looks appealing, but I love my work so I'm still stuck for now. Even a simple "I've worked in X language, they all have problems" from a few folks would be nice.
9
u/Odd-One8023 Jun 03 '25
Significant whitespace is quite nice because it sets a lower bound on how bad code can look like. Before I joined my colleagues were writing code without a formatter.
There is type checking in Python, I always roll with type checking on standard and now the entire team does too.
Everything shouldn’t be a dictionary, you have pydantic and dataclass. Name your data.
Pass by reference or value matters less if you treat most of your data as immutable. Pass by value makes it seem like you want to mutate stuff. IMO this is a bit of an x-y problem.
I rarely need to write
__name__ == “__main__most things I write are scripts that don’t need it, packages or APIs.
2
u/AiutoIlLupo Jun 03 '25
I've programmed in python for 20 years. name == main is not used since entry points have become the norm. The problem is that OP is a scripter and uses scripts, and they use extremely poor, outdated practices in his team. The proper way to do it is to define a package, and set an entry point.
6
u/OhYourFuckingGod Jun 03 '25
I've done both C++ and JS professionally, and it's generally not better. Some of the issues might have been mitigated by newer releases, but I suspect not.
With C++, for any product of reasonable size and maturity, expect monstrous compile times, insane build systems and technical debt so deeply integrated that it's basically a feature at this point. The syntax and sheer scope of the language is massive and growing with every release, so you probably won't be able to use most language features because of legacy codebases, corporate coding standards or just from the fact that you couldn't possibly know all the language features.
JS is different. It's getting better, but really shows that it evolved from something that solved a completely different problem.
1
u/Electronic-Fix9721 Jul 26 '25
JavaScript has gone incredibly good in recent years. React Native, Express, installs a completely destroyed dependency tree without a problem. Just needs a good ML library, pandas and I jump ship forever.
2
u/DataPastor Jun 03 '25
Whether you like Python or not, it doesn’t matter, since it is the industry standard. And for a reason! It is just the right level of abstraction for experimenting, prototyping and actual data programming (btw. NEVER use a for loop or iterrows for matrix operations….)
If you are bored, learn to use polars and duckdb.
If you are VERY bored, learn Rust and PyO3.
1
u/todofwar Jun 03 '25
I think the fact that people say "don't use a for loop" is my biggest pet peeve by far at this point. A list comprehension is a for loop!! Numpy has for loops! It's all for loops! Python speak is so far removed from sensible discussion of algorithmic analysis or data structures all because it's so unbelievably slow!
I know not to use for loops. I know how to rethink problems to make use of libraries. I just hate it.
Not a fan of rust, but I am trying to experiment with cython a bit
2
u/DataPastor Jun 03 '25
A list comprehension is not a for loop, it just uses the “for” keyword. :) It is a combination of map, filter and lambda in functional programming terms, or a monadic bind, or in short: a comprehension. :)
But you are right, at the end of the day, at the machine code level all vectorized operations use a for loop. :)
0
u/todofwar Jun 03 '25
Fair enough. It's ironic, python claims to get out of your way and yet most C compilers are so efficient that you don't even need to pay attention to that stuff. You just write a for loop and it works.
1
u/deadwisdom greenlet revolution Jun 03 '25
Python is not supposed to be fast. It's the lowest priority. If you don't understand that, like truly *feel* why that's correct and actually *good*, you will always be lost.
Anyone who is says "don't use a for loop" has already lost the fight. Don't be in a spot where you have to worry about for loops.
1
u/Old_Wear_2032 Jun 03 '25
I have also been working with python for almost 10 years now and I LOVE it to death.
To address your problems:
- too slow: you can always write in Rust/C/C++ and bind it back to python. If I were you, I would probably write cython + numba on a daily basis for AI/ML prototyping.
- dynamic typing: I also hate it so much, its the only thing that I hate about python.
- all other nuances don't matter: indentation, __name__ == __main__, every language has its own quirks.
- everything is a dict: now that you mentioned dictionary and JS, oh man you should see what is going on in the JS/TS ecosystem...usage of {} everywhere, they have args and they don't even use args at all in functions.
I think you thought you liked C++/JS because you used them to do some fun stuff, not because you really like them better than python. think about all the memory issues and pointers you need to deal with in C++, think about all the frameworks after frameworks after frameworks and configs and quirks in JS/TS for web development, think about the ugly syntax in Rust. In the end, you can always write in different languages, its not like you cannot use python anymore if you now switch to write in C++ more.
1
u/todofwar Jun 03 '25
Thank you for reading and responding to the whole post. I'm sure if I worked with any other language professionally I'd start to dislike it too. Bjarne Stroustrup said there are languages people hate and languages people don't use, it's probably something like that
3
u/Ringbailwanton Jun 03 '25
To me, it’s always been about solving the problem in the best way possible. Find the solution, document, test, improve and refactor. I guess that’s how I continue to find joy in working with Python. At the end of the day, you do the best work you can with the tools you need to use.
3
u/Objective-Apple7805 Jun 03 '25
As someone who wrote C and C++ professionally for more than a decade, the things you describe are among the reasons why I like Python so much better.
Sounds like your main complaint is performance, which is inevitable for any interpreted language. I heard the same complaints about compiled languages vs writing in Assembler. (Yes, I started coding at the tail end of the punch card era).
Not sure why it’s such an issue for ML, though, all the libraries are optimized anyway. Maybe try Polars instead of Pandas.
Or maybe learn Rust if you really have a need for speed.
3
3
u/Wing-Tsit_Chong Jun 03 '25
Write a few of your current python projects in c++ and see how it goes. And I mean all of it: the build, make files, compiler, linker, the buffer allocation, debugging segfaults, people doing integer arithmetic on pointers and everything's a struct. There is always something to hate about a given tool, because no tool can do it all.
What I love about python is that it allows to think about the actual algorithm and ignore the boilerplate, because it's already there or abstracted away. Passing dicts or looking at everything as dicts, allows for quick and dirty solution when in a pinch. Imagine using java and somebody declared the class member as private and no public way to modify it quickly. And as much as if __name__ == __main__ sucks, so does public static void main(String[] args)
If you optimized your 3 deep for loop by switching to numpy you didn't really do anything, right? You could've also thought about the algorithm and implemented it more efficiently and gained a lot more than x100.
What I mean is, the infuriating thing about programming is not the language, it's always other people, including past selfs, that abuse it.
3
6
u/Smok3dSalmon Jun 03 '25
You're not going to get a lot of sympathy here my guy. All your problems are solved or solvable. Nothing you ranted about is agreeable.
Why don't you start implementing the changes you need to hate it less? Go check out CPython or ways to implement bindings to C++ and typing is obvious.
2
Jun 03 '25 edited Jun 03 '25
Rust is similar to C++ and has been gaining some traction in the ML community for its speed compared to python, so that's an option. But yeah like everyone else mentioned the beauty of python is you can import libraries to fix anything that annoys you or even make one yourself. Python is definitely simple and very readable in most cases. But is it fun or enjoyable? No. I can at least agree with you on that. Low level is so much more fun and interesting
2
u/schvarcz Jun 03 '25
Well, lately I am on the same vibe.
As a AI/ML engineer, I like to implement the underneath algorithms. And every time I try to do that with python, it is always takes ages to complete a simple task.
During my master/phd I got the same conclusion and I adopted C++. Working life is mostly “applying algorithms”, so we can survive using python libraries. But… it is not fulfilling.
If you think about it, all algorithms that we use in python are actually coded in C++. However, these libraries have no proper interface in C++ itself, therefore, not really usable in C++. I believe this situation comes out from “go PROD fast!”-culture. Meaning, the popularity of a library often comes out from how simple and fast you can implement something with it.
That might have led us to a wheel of “showing results fast” that got us stuck here.
On the last years, I have also been seeing a drop in professionalism in this sector as whole. AI/ML is becoming a commodity. And as such, I think we will see more pressure towards this direction.
My only hope is that AI code assistance may help convincing people to stick to “harder languages with more flexibility”; or at least help us moving a way from this ocean of interpreted languages.
2
u/Livelife_Aesthetic Jun 03 '25
I didn't really vibe with or enjoy python untill I added libraries like pydantic to fix alot of my issues with it, I don't think you should have to add libraries to make a language not frustrating but as someone is who stuck using python everyday, it makes it the best it can be.
1
1
u/le_theudas Jun 03 '25
I think the biggest advantage of python is speed of development. It allows you to implement solutions much quicker compared to writing everything in c++. While you have some valid points about dynamic typing, I rarely see this actually causing bugs.
For anything that requires true performance, I would suggest implementing it as a module in rust/cython. Doing that also lets you enjoy python again :)
1
u/Tinche_ Jun 03 '25
Lean into type-checking and proper data modelling with dataclasses, enums, literals, unions and all that jazz.
Disregard the reddit peanut gallery about how Python is a dynamic language - if that were true today there wouldn't be like 4 major typecheckers being actively developed. It's antiquated thinking.
1
1
u/AiutoIlLupo Jun 03 '25
Most of the times I've seen that the problem is not python, it's that people don't know how to code properly and make a mess.
1
u/Alternative_Act_6548 Jun 03 '25
so, go write everything in C++, it shouldn't take you much longer...no language is perfect...
1
Jun 04 '25
Maybe you should try to focus on writing C++ or Rust to be consumed by Python - get a job at Astral or something
1
u/TutorialDoctor Jun 10 '25 edited Jun 10 '25
My first language was Python, and I like it the most still. It's the most fun to me.
My learning journey went: Javascript > Python > Javascript > Python > Ruby (for ruby on rails) > GDscript > Javascript > Ruby (for ruby on rails) > Swift > Java (for work) > Rust
So, I've been learning Javascript for a number of years and only use it when I have to. I avoided C#, C++ because there wasn't any instant gratification. So here are my favorites
Python - A swift army knife. It can do anything and it is the most used language for AI.
VueJS - easy to understand and has a CDN for quick prototypes
Flask - great for quickly prototyping full stack app concepts. Works really well with HTMX
Ruby Rails - Good for startups (can get an MVP done in days). Version 8 is even better
Flet - A really good GUI python framework for building desktop apps in Python. It uses the flutter framework in the background
GDscript - Python-like programming language for making games in the Godot game engine. My years of python programming paid off and helped me make games in this engine.
Tailwind CSS - my favorite framework for quickly creating UI's.
Swift - For some reason it feels slow, but I'd use SwiftUI and SwiftData if I were to make IOS apps.
Rust - only use it because I like Tauri and only when the JS api can't do what i need.
Tauri - right now this is my favorite framework and not because of Javascript, but because i can build a secure desktop application and easily distribute it. I use VueJS with it as well as several plugins like Tauri Store and Tauri SQL.
Java - Learning this for work but it's useful for learning software development concepts you just can't learn in Python. At work I currently use Vaadin with the Flow framework, but you can also use Vaadin with Hilla (A react version).
Angular - nope
React - Vue is simpler
C ++ - maybe if I wanted to one day do some "real" game engine programming
C# - Why would I?
Dart - Who?
Go - Where?
Other languages - too many to even care about.
If you think you're tired....
Oh, still learning Javascript..
I wouldn't say they all have problems. I'd say they all have their strengths.
1
u/daviziiin Jun 03 '25
If you want to do AI/ML and get some C++ done, go for embedded ML, plenty of code optimizations needed.
0
Jun 03 '25
[deleted]
3
u/todofwar Jun 03 '25
Quite the contrary, I'm hoping people here will change my mind! I thought that was clear in the original post. Using a different language just isn't an option for me so I'm trying to find reasons to like it (or at least realize that other languages suck too)
3
u/silvercurls17 Jun 03 '25
Personally, I think Python is easy and fast to develop in. It has a lot of advantages with extensive libraries available to do just about anything. But for most applications it’s the second best option. It’s kind of the Swiss Army knife of software development.
I’ve been doing software/systems engineering now for over 20 years and I’ve come to the conclusion that all languages, frameworks, and so on suck. They just suck in different ways but usually have advantages for certain types of applications.
At least it’s not Perl.
0
53
Jun 03 '25
[removed] — view removed comment
18
u/usrlibshare Jun 03 '25
I can second that. Use type hints and a static analyser like pyright. Python where you at least have a chance of getting yelled at by the LSP when you're about to make a big no no in your code, feels much different.
6
u/NightmareLogic420 Jun 03 '25
Completely agree. The dynamic part of python is honestly it's biggest flaw for me.
1
u/silvercurls17 Jun 03 '25
I don’t mind the dynamic typing. The biggest flaws I’ve found are the python virtual environments/packaging and multiprocessing with the GIL. Most other languages are better in this regard.
An honorable mention for clunky api/application frameworks and orms. Never did I ever think that I would miss Java but several years in python did it for me. Going back to Spring Boot has been a nice change.
1
u/Electronic-Fix9721 Jul 26 '25
That! It's a nightmare to install, every time. If the wheel isn't available, you need to compile. If it doesn't compile, translate the whole project to any other language and it'll be faster in most cases.
5
u/felixthecatmeow Jun 03 '25
I agree but it's hilarious how the answer to "how do I hate python less" is to make it as "not python" as possible...
2
u/mrsaturn42 Jun 03 '25
So i went down this path, and in fact my work started enforcing type annotations in CI. The type annotation system works great for that, annotation, but it becomes a mess if you have strict enforcement. At some point it defeats the purpose of using an interpreted language like python and you wonder what you are doing with your life with all this over head.
1
u/InspectahDave Nov 27 '25
agree with this. Typing really changed the game for me. I think that if you do have it, you can choose when to relax it and allow looser typing with typing.Any or object if you need to. Generally I work with strict. I think overall it wins in the cost benefit equation as the code grows in complexity. It's brutal for some but it catches a lot of issues before deployment. If you can get away from naked dictionaries as containers that's a big win too. dataclasses are light and fast - there's also the typeddict that gives you backwards compatibility.
1
u/MachinaDoctrina Jun 03 '25 edited Jun 03 '25
We go even further at work (Also ML/AI), we write our entire stack around pydantic objects actively enforcing typing for the dataloader object return "types" effectively guaranteeing that we will have cross compatibility between our models.
All CD/CI pipelines run a series of linters which include mypy which won't get through if your type hints are garbage or you haven't done it and we automated all of this with a precommit script so its nice and easy.
Python can play nice with production environments its spaghetti code where it gets horrible.
We also write quite a lot of C11 wrapped python functions for things like for large for loops etc. Which effectively sidesteps the GIL as well as you can directly access CUDA if your feeling game or we've been looking into JAX which has decent CUDA directives but we mainly use PyTorch.
1
u/MacShuggah Jun 03 '25
People will still turn to dictionaries to model anything and all will still suck.
-6
u/todofwar Jun 03 '25
I admit this is a discipline issue on my part. I start out type hinting everything but soon I skip it for a couple of helper functions and then I just stop (I can tell the order I wrote a .py file by the frequency of type hints). I need a reason to type hint things I guess
14
u/Smok3dSalmon Jun 03 '25 edited Jun 03 '25
Stop being a feral dog :P
Implement a linter rule for Ruff that forces all variables to be type annotated.
7
u/Chroiche Jun 03 '25
This is like eating food you're allergic to and then complaining about the stomach ache.
2
u/Veggies-are-okay Jun 03 '25
Could be worth it to get the Cursor IDE solely for the tab complete. Not sure if copilot is doing it nowadays but between that, doc string generation, and in-line edits you can easily get your $20 worth without going down the vibe code route. Hell, even a touch of the agent can be great to get all scripts adhering to linter rules.
AI gets a bad rep but I think it can be a fantastic time saver to do the not-so-fun janitorial work so you can focus on the parts that actually require deep thought.
-1
u/todofwar Jun 03 '25
Yeah I've been using copilot cause my job pays for the license. I've been pleasantly surprised by how well it does. Still annoying as hell IMO
4
Jun 03 '25
If you use basedpyright, there is an option to have it automatically write the type hints for you (function parameters, function return type, variables)
1
u/Drevicar Jun 03 '25
Well typed code actually doesn’t need many type hints. Type inference does most of the heavy lifting. And there are even a bunch of tools and ide integrations that will auto insert the hints for you. Then all you have to do is enable mypy and ruff strict mode and it will force you to write good code.
34
u/eleqtriq Jun 03 '25
"I hate dynamic typing" Use Pydantic for data validation or mypy for static type checking. Python 3.5+ has excellent type hints that catch most type-related bugs at development time.
"Pass by object reference is the worst way to pass variables" . This is probably the best way for a dynamically typed language. Anyone feel free to chime in on this.
"Everything is a dictionary" This sounds like a code organization problem, not a Python problem. Use classes, dataclasses, or Pydantic models instead of raw dicts. Modern Python has great tools for structured data.
"I can't stand name == main" Fair enough, it's ugly.
"interpreted white space" Use a good formatter like Black or autopep8 and forget about it.
"pure python is too slow" You're not supposed to write pure Python for performance-critical code. That's what NumPy, Pandas, PyTorch, etc. are for - they're all C/C++ under the hood. Python is the glue language, not the compute engine.
It sounds like you're fighting against Python's ecosystem instead of working with it. Every language has warts, but Python's tooling has gotten incredibly good in the last few years.