Live data from Hacker News

If AI writes your code, why use Python?

medium.com

721–730 of 1001 posts

Re: If AI writes your code, why use Python?

#721

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…

Python outputs is also very versatile. You can use Python to build command line script, web application, desktop app with GUI, notebook with data analysis, or Python package and share with others. It is many ways how Python code can be used by final user.

Re: If AI writes your code, why use Python?

#722
post #397

Read 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…

Plus Perl has very efficient minimal syntax, with "Perl golf" training set it is almost like ascii bytecode for LLMs.

Re: If AI writes your code, why use Python?

#723
post #690

Low 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.

Does the event loop not exist? Go has parallelism where JS does not. Both are able to run concurrent actions (async in JS).

Re: If AI writes your code, why use Python?

#724

Earlier 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.

There are many languages with similarly strong type systems - Scala, Kotlin, OCaml, etc (and nowadays, even Java). A GC may also be an advantage in that the LLMs may get it right in less tries.

Re: If AI writes your code, why use Python?

#725

Earlier 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?

Yeah, I don't think you really learn a language with agentic coding, at least you wont become fluent writing it. I currently use copy pasta chatbot help to write some C code and I am still often stuck how to progress manually. And I refactor a lot because the LLM code is subpar for me.

Re: If AI writes your code, why use Python?

#726

Earlier 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.

Name one of those abstractions that is missing in Python.

Re: If AI writes your code, why use Python?

#727
post #715

Earlier 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)?

They tend to ignore such instructions on first circular issue - even with Opus you have to kick it really hard, insist on generalization and intervene manually. In my opinion this is not a productive/workable approach for large projects.

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?

#728
post #715

Earlier 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)?

You're devolving into the realm of "What if we tell the agent to just get it right?"

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

Yeah and

> 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.

Post reply on HN