One obvious reason is Python's extreme readability, it has often been described as being as close to executable pseudo-code as one can get. If you're using an LLM to write code I think the rules would be 1. Use a language you know really well so you can read it easily, and add to it as needed. 2. Use a language that has a large training set so the LLM can be most efficient. 3. Use a language that is easy to read. If…
Haskell is more readable. It looks just like pseudocode. Change my mind.
If AI writes your code, why use Python?
921–930 of 1001 posts
Re: If AI writes your code, why use Python?
#922Earlier quoted context omitted.
You joking? - strong typing - real concurrency (heaven forbid you want a background task without having to spool up an external message queue and worker) - immutability - limitations in error handling (sort of just typing really) - limitations in nullability (also typing) - memory layout is usually hidden or abstracted away - no actual private methods or classes That's far from a complete list, but maybe you're takin…
> strong typing Python is a strongly typed language. Strong and Static typing aren't the same thing.
Python does provide type annotations and extensive tooling to make static analysis, so this whole "missing abstractions to help with understanding" is simply false. You can even setup a python project to make annotations mandatory.
There are plenty of things to criticize about Python - performance, packaging and multiplatform distribution come to mind - but to think that it is missing the tools to help build and understand complex codebases is frankly absurd.
Re: If AI writes your code, why use Python?
#923Earlier quoted context omitted.
>Lack of strictly enforced static typing make agents fail much sooner with Python. Just tell your agent "Use type hints. Add a pre-commit hook to run ruff, black, mypy, and pytest." It will save you 99% of headaches.
I've tested many flows involving linters. Results are far from ideal - agents tend to work around linters, mass-add ignore annotations, etc, especially in situations when fixing one warning/error triggers another (and that happens regularly).
Re: If AI writes your code, why use Python?
#924One obvious reason is Python's extreme readability, it has often been described as being as close to executable pseudo-code as one can get. If you're using an LLM to write code I think the rules would be 1. Use a language you know really well so you can read it easily, and add to it as needed. 2. Use a language that has a large training set so the LLM can be most efficient. 3. Use a language that is easy to read. If…
Re: If AI writes your code, why use Python?
#925This isn’t foolproof - you still have to understand what was proved. And it may take some work to understand the unproven parts of the code. But I believe this is the path forward.
Re: If AI writes your code, why use Python?
#926Right, you should use Lean or Coq. They are cleaner mathematically, which means AI has a better chance with them. And you can have the AI write proofs about their correctness. The proof-checker can verify the proofs and give you more trust in the AI’s work. This isn’t foolproof - you still have to understand what was proved. And it may take some work to understand the unproven parts of the code. But I believe this is…
Re: If AI writes your code, why use Python?
#927Earlier quoted context omitted.
I never really understood what exactly is so readable about python. I've been developing in Python for 8 years now, and before that I was a C# developer, and I don't find Python to be that more readable. Sure there's less ceremony, and yes, you can have your project going with just a single file, but other than that...?
I think the meme come from the fact that in 00s and early 10s most people looked at Python code coming from C++ and Java. In Java bad OOP conventions were commonplace, like everything using getters/setters, deeply nested class hierarchies and insane patterns like AbstractSingletonProxyFactoryBean. It got impossible to figure out what's going on. C++ just got every possible feature that badly interacts with each other…
Incidentally, even though I still hold those opinions, I can admit that history has solidly shown them to be unfounded.
Re: If AI writes your code, why use Python?
#928Earlier quoted context omitted.
Surprisingly, LLMs are actually much worse at reasoning in Python than other common programming languages for agentic coding tasks. Data here: https://gertlabs.com/rankings?mode=agentic_coding
> Data here: https://gertlabs.com/rankings?mode=agentic_coding Oh wow, we got "tribal domination", "market simulator" and "adversarial customer service". I don't know what those are but it sure sounds like big torment nexus milestones Maybe we could at least play nicer games like hackenbush and act surprised when there's some wicked use-case that's isomorphic. EDIT: Ok fine. I like "Rubik's Cube Chess" a lot. Never h…
Re: If AI writes your code, why use Python?
#929Too capable for a job control language, interesting objection, but if a job control language is too capable, it becomes a job implementation language...
Too slow to implement applications. So many examples of big balls of Python code creaking and struggling, slowly. Just one example: my homeassistant instalation running three lights overwhelmed a Raspberry PI 4 causing it to crash once a week.
To me Python is a poster child for "popularity is not quality".