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…
If AI writes your code, why use Python?
721–730 of 1001 posts
Re: If AI writes your code, why use Python?
#722Read the first few comments and surprised I didn’t see it, but training data. The voluminous amount of Python in the training data. I could write in brainfuck with ai, but I presume, wouldn’t get the same results than if going with python. My follow up question: with AI now, why care about a lang until you need to?
I had an itch to give Perl another go after a 5 year hiatus. I wanted a super simple way to spawn a proxy I was building in Go, along with writing various integration tests. I used Claude Code to write the bulk of it and found Claude to be remarkable good at Perl. I told Claude to only use what’s built into Perl’s standard library rather than reaching for anything in CPAN. Turns out everything from HTTP clients, TLS…
Re: If AI writes your code, why use Python?
#723Low bar critiques: > For the last decade, fast-to-ship beat fast-to-run. Not anymore. Fast-to-ship didn't beat fast-to-run, it was "beating" "quality built software." It still is. Beating here implying that it's the focus of companies. > picked a harder, faster language Go is absolutely an easier/simpler language than JS/TS. > The Python ecosystem is increasingly a Rust ecosystem wearing a Python hat. The Python ecos…
> Go is absolutely an easier/simpler language than JS/TS. You're suggesting that a language with concurrency is simpler/easier than a language that does not have concurrency.
Re: If AI writes your code, why use Python?
#724Earlier quoted context omitted.
hmm, yeah given LLM's ability to churn out lots of code quickly and be overly verbose in that code that is a potential downside. That it could in a quick one time edit create so much intellectual overhead that Python might be the wrong language to understand what is going on. What language do you feel is easier to reason about in the large?
Haskell would be my vote, and Rust too, actually, both because of their very strong type systems. The type system lets you very quickly figure out what something is before you figure out what something does , and it turns out that separating those two concerns as hard as those two languages do often results in doing the whole one-two punch faster.
Re: If AI writes your code, why use Python?
#725Earlier quoted context omitted.
You'll learn Rust faster with AI and should be able to solve it yourself. You're unlikely to wind up in such a situation though. The design work Claude does in Rust is really sensible and idiomatic, and I really don't think you'll be unable to refactor or redesign things. Claude is extremely good with Rust generation, refactoring, and manipulation. I'll go as far as to say that AI has removed most of the complaints p…
Come on now, how do you learn anything if you just tell claude to do something and feed it error messages?
Re: If AI writes your code, why use Python?
#726Earlier quoted context omitted.
For larger systems you create your own modules and abstractions, so comprehensibility at higher level does not depend so much on the language.
The tools the language gives you to create those abstractions make a lot of difference, however.
Re: If AI writes your code, why use Python?
#727Earlier quoted context omitted.
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).
What if we tell the agent NOT to add ignore annotations (or to ask about them if there's no other reasonable way to proceed)?
Typical failure mode: "I fix pyright error A, it causes pyright error B, pyright is broken, I will exclude both A and B through pyright config and will add ignore annotations for both A and B and will write a couple of idiotic comments about that".
Re: If AI writes your code, why use Python?
#728Earlier quoted context omitted.
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).
What if we tell the agent NOT to add ignore annotations (or to ask about them if there's no other reasonable way to proceed)?
Relying on the prompt to ensure the code it writes is correct is where things fail. Types, tests, linting, etc. are deterministic tools the agents tend to respect.
Re: If AI writes your code, why use Python?
#729> Nicholas Carlini, a researcher at Anthropic, orchestrated 16 parallel Claude agents to write a production C compiler in Rust. To write a proof-of-concept C compiler, not a production-grade one... Hard to take the article seriously after this
> A C compiler written in Rust used to be a graduate thesis. It isn’t anymore.
Or maybe like a little recreational project for multiple weekends.
There is that weird myth that writing compilers is super hard. Writing a toy C compiler is not that big of a deal. It is a pretty simple language.
Now production-grade is another beast but that is something AI can't do.