Live data from Hacker News

If AI writes your code, why use Python?

medium.com

551–560 of 1001 posts

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

#551

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 that pseudocode aspect is what makes it hard/frustrating to read for me.

I'm more of a c++/TS/etc user, so I miss braces a lot. I think a basic Python script sure it's easy to read through, but a large project starts to get quite ugh.

I am very jealous of Python's numerous built-ins though. I was looking for a JS sum function the other day and was surprised to see node.js still doesn't have a built in + you still cannot reference operator functions.

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

#552

Earlier quoted context omitted.

I’m super surprised that C++ scores so high, this does not match our experience at all, and for anything performance critical it always drops the ball completely. I also don’t understand how these “games” map to real world complex problems. How are you measuring success? How does “adversarial customer service” map to “this LLM is better at C++ than the other” ? How are you sure you’re not just benchmarking language s…

- The majority of the environments can be played where the agent writes code to work the environment towards a goal. So the model is problem solving, and it has to do so in a particular language, and some languages outperform others. We have a lot of data to back up the improved compiled language performance, but note these are for successful code submissions (failures are counted in a different metric). With the Lan…

I think my problem is that I’m not sure I understand whether you evals are testing language abilities or reasoning abilities.

It seems to present results as if they’re testing language abilities, but the problems seem to be reasoning problems.

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

#554

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

Python is faster to write so obviously you'll see things built in Python first more often than the reverse. What's that quote -- "Better to remain silent and be thought a fool..."

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

#555
post #481

One underrated advantage of using Python or Typescript is that AI agents can inspect the code of installed dependencies. This means you don't have to muck around with supplying the right documentation for each version of each dependency, or worry about hallucinated interfaces (at least with the latest models). In the past you'd have to dig through a foreign codebase manually to figure out why a documented interface f…

LLMs are now smart enough to simply download the code of any project they want to inspect. So this argument doesn't really hold up anymore …

Sure, but will they download the right version? And will they be inspecting the right files on disk? There's a whole lot more that can go wrong

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

#556

Earlier quoted context omitted.

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.

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?

C# is as close to an ideal language as you can get for most things IMO. I find AI does a great job with it.

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

#557
post #323

Earlier quoted context omitted.

No batteries!? Go has a huge stable standard library no other language even comes close to. Built in tooling for unit testing, performance testing, debugging, code formatting, package management, etc. And most go binaries can be compiled statically so libc is not even a dependency. Golang is the definition of batteries included.

> Go has a huge stable standard library no other language even comes close to Well, Java and Python do.

Yet the first thing most people do before making a HTTP request is pip install requests

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

#558

Earlier quoted context omitted.

I find brackets help me understand structure from a distance much better than whitespace. Misplaced brackets seem like a thing from the past to me when we didn't have IDEs. I don't remember ever having a bug due to that.

> I find brackets help me understand structure from a distance much better than whitespace. I can't imagine how. Whitespace physically lays out the block structure on the screen; braces expect you to count and balance matching symbols, and possibly scan for them within other line noise.

Working in C# i feel basically still read code structure by the visual block structure / indentation. I dont think I've ever counted braces in my professional life. The IDE makes sure it is formatted correctly and ambiguity is basically impossible.

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

#559

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.

I was (pleasantly) surprised by Claude Code doing Raku - also with a limited training set (~2000 Stack Overflow, a bunch of Rosetta, 2,500 modules). I put this down to the quality of the code for the core community who are all frankly uber-gremlins.

Yeah Raku feels so expressive and lovely to me with the help of an AI assistant. I've only done toy programs and scripts with it but it is actually so nice.

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

#560
> The old open-source bargain had a positive feedback loop. You pick Python because it’s easy. You find a bug in a dependency. You fix it.

> Agents broke that loop in a specific way: the unit of contribution shifted from the patch to the port.

What does this even mean? Every time there's a bug we port the whole code to a different language instead of patching it? This sounds like absolute nonsense, and makes me wonder whether a human actually wrote this.

Post reply on HN