Live data from Hacker News

If AI writes your code, why use Python?

medium.com

501–510 of 1001 posts

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

#501
I use a mix of both to try and leverage their advantages.

Rust in most cases, especially for back end.

Python when it's low risk (say monitoring dashboard or similar API heavy) or plays to python strengths (e.g. ML/AI - everything ML seems to be python).

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

#502

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?

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

I thought it might have to do with the type system, but JavaScript type system is atrocious and it scores about 50% higher. So my theory does not make much sense.

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

#504
Other correctly point out it does matter what language the code is in since the human does sometimes need to read and understand it.

But also, I suspect the article is just wrong. "The hard languages got easy first" isn't true in practice and the impressive examples given are not representative or as magical as the poster makes them out to be.

The takeaway might be right in the end, but the post isn't right in the beginning.

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

#505

Earlier quoted context omitted.

That's a good idea. Would you rather see Lisp or Scala? Any interest in Prolog? We are trying to be selective to keep the data concentrated, but we will eventually add a couple more, most likely to sample different programming paradigms.

If you are taking request, I was hoping to see clojure on there.

My spider sense tells me the immutable-ness would help with correctness, but I'm not sure how much difference it would make in practice. Would love to see some numbers.

A relative lack of training data might have a bigger effect though.

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

#506

Earlier quoted context omitted.

That's a good idea. Would you rather see Lisp or Scala? Any interest in Prolog? We are trying to be selective to keep the data concentrated, but we will eventually add a couple more, most likely to sample different programming paradigms.

Just last night I was going down the rabbit hole of "what's the best programming language to use for vibe coding." I came to a short list of: a) Typed Racket b) OCaml c) Julia I would love to see those three added to your benchmarks. And Mistral Medium 3.5 added to the LLM list, please.

Those are some fine languages, but how did you pick them? What was the criterion?

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

#507
post #476

How about modern Java? Any experiences?

Disclaimer: I love writing production systems in Java. I was a C++ programmer for 10 years before moving to Java about 15 years ago. Java offers a virtually all in one package when writing large systems. You have a single language where you can write code that doesn't care to be the fastest possible, and you just rely on ZGC to do its thing, and it works. Or you can write GC free code with a mostly quite performant SoA type approach. You can do this in the same codebase, and developers don't need to know different languages to write either style of code. You then have one build system, one deployment system, an incredible set of observability tooling, etc, etc.

So I might be biased, but with the correct curation of AGENTS.md files and skills, we're getting extremely good results using Claude Code writing Java.

Another disclaimer: I haven't tried with another language, but we're happy with the results.

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

#508

Earlier quoted context omitted.

Hah, I was just thinking that Python likely has a vast ocean of training data, but it's likely of lower quality, being much of it is written by beginners and those who aren't primarily programmers.

That was the hardest part of learning PHP, all the code examples online were just awful.

Worked on a PHP project once. Every time I asked why something was done a certain way the answer was "dunno, we copy pasted this code snippet."

Certain popular PHP codebases appear to use a similar methodology.

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

#510

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…

I think this is where D language make an excellent alternative to Python for AI assisted coding [1].

1) It's a very consistent language even if you compared to the other popular languages namely Python, Rust, C++ and Go. Try to perform doubly linked list with them and compare them all [1].

2) It's probably the most "Pythonic" among the compiled language according to Walter.

3) It utilizes GC by default, you can also manage your own memory and you can hybrid.

4) It compiled fast and run fast, heck it even has built-in REPL eco-system.

5) Regarding the small training set, with recent self-distillation fine-tuning approach it should be good enough, D (actually D2 version) has been around for more than a decade [2].

[1] Looking for a Simple Doubly Linked List Implementation:

https://forum.dlang.org/thread/osmecwfnpqahoytdqpkr@forum.dl...

[2] Awesome D:

https://github.com/dlang-community/awesome-d

Post reply on HN