Live data from Hacker News

If AI writes your code, why use Python?

medium.com

751–760 of 1001 posts

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

#751

Earlier quoted context omitted.

Python is amazing for scripting. Python is terrible for writing big systems. Projects whose V1 is written in Go/Rust/C++ don't normally go out and re-write V2 in Python. The reverse is really common. Even many famous Python packages are now Python wrappers. https://ashishb.net/programming/python-in-production/

> Projects whose V1 is written in Go/Rust/C++ don't normally go out and re-write V2 in Python. That's because you would usually rewrite your Python program in something like C++ if you realise that it's too slow and you need the speed of a compiled language, despite the enormous extra complexity to create and maintain it that way. You wouldn't go back the other way because it's very rare to go to all that extra effor…

> You wouldn't go back the other way because it's very rare to go to all that extra effort writing in a more efficient language only to realise that the slower performance of Python would've been adequate after all.

It's UIs which are typically rewritten in more "fun" languages - occasionally because it becomes too much of a maintenance burden when all one wants to do is move around some form controls.

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

#752

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 is locally readable. Reasoning about larger systems in Python is where things get really hard, because you have to describe how many small individually readable things interact with each other in a very limited vocabulary.

Although it's not part of core Python, tach is pretty handy for specifying and enforcing those larger-scale interactions: https://github.com/tach-org/tach

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

#753
post #708

Earlier quoted context omitted.

You could use Scala, get the strong typing, but also get access to the Java and also Python/JS libraries and others via various interop mechanisms Java has.

And you also get compile times so long you’ll never run out of tokens! I kid, I kid, but seriously …

"sbt --client" is really fast for me, and I'm using derivation and implicit scope etc. super warm JVM, incremental compiles.

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

#754

But under this frame, it appears that the developer's task involves prompt engineering. This is not the case. Even if an agent generates 90% of the code, each and every diff is going to be in my review queue. Code readability of Python isn't an advantage during write; it's an advantage while reviewing. As an agent generates a piece of code, I will have to read the code, comprehend the code, and determine whether it d…

the trend is AI also does the code review. Too many anecdotes and studies showing AI is a better code review that a human and the models are just going to get better.

Whether we get better results if AI reviews Python or Rust I'm not sure. But I suspect Rust will win out as the training data likely has more content around Rust correctness and language usage than Python does.

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

#756
post #584

Earlier quoted context omitted.

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.

Haskell does not qualify for a large training set, though. (Nor for readability in my opinion) I think I have never seen haskell software made wih LLM's but well, aside from university, I have not seen Haskell code at all. (Also Haskell purists I would associate with people who avoid LLM's) I would rather go with Rust given these choices. But I have good results with typescript (or javascript for simpler things). Rea…

I used Claude that created a terminal based table viewer from rust first, to lean , and finally to Haskell. https://github.com/co-dh/tv-hask/tree/main

I give up rust because it’s not functional enough. There aren’t many things Claude can prove about a table viewer, and Haskell fits very well, and have enough libraries. Claude is pretty good at Haskell. I barely write Haskell before but I do know monad.

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

#757

Earlier quoted context omitted.

This must really depend on your niche. I assume you do web stuff or something? Good luck finding any golang examples in a lot of other fields. Rust, on the other hand, is taking over the world in systems programming.

> Good luck finding any golang examples in a lot of other fields. There are go examples (and full blown programs) for anything, from servers to Kubernetes and Docker.

Yes. Maybe I should have said web stack?

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

#759

But under this frame, it appears that the developer's task involves prompt engineering. This is not the case. Even if an agent generates 90% of the code, each and every diff is going to be in my review queue. Code readability of Python isn't an advantage during write; it's an advantage while reviewing. As an agent generates a piece of code, I will have to read the code, comprehend the code, and determine whether it d…

the trend is AI also does the code review. Too many anecdotes and studies showing AI is a better code review that a human and the models are just going to get better. Whether we get better results if AI reviews Python or Rust I'm not sure. But I suspect Rust will win out as the training data likely has more content around Rust correctness and language usage than Python does.

You must have a low bar for human code review. I've seen that in practice too. But I've also been on teams that took code review very seriously, and frontier AI really doesn't come close to a good human code reviewer imo

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

#760

But under this frame, it appears that the developer's task involves prompt engineering. This is not the case. Even if an agent generates 90% of the code, each and every diff is going to be in my review queue. Code readability of Python isn't an advantage during write; it's an advantage while reviewing. As an agent generates a piece of code, I will have to read the code, comprehend the code, and determine whether it d…

> Python is, thus, clearly superior to other languages in terms of ease of review.

My experience has not been this. Dynamic languages make it harder to figure out things locally, unless someone has done the hard work of adding type hints.

Post reply on HN