Live data from Hacker News

If AI writes your code, why use Python?

medium.com

521–530 of 1001 posts

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

#522
In my experience Python is fine. However both Go and Flutter(Rust) are better due to the tools that are available, especially the compilers. Flutter in particular surprises me with how good LLMs are at it. Both might actually be thanks to good documentation. Maybe that they are not VERY fragmented and don't have a lot of baggage.

Frontend CSS/HTML is pretty bad though. Although they can work, it takes a lot of pushing. It's probably normal since they do not actually have eyes yet.

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

#523

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?

With AI it is important to catch errors/hallucinations early, static typing helps with that.

So languages with dynamic typing might hide some errors until runtime, static typing one could catch that during compilation.

With dynamic ones you need way more tests to cover some of the scenarios that compiler does for others.

And there is significant amount of code written "for ages" in languages that were there longer, like C, C++, Java (yes, I know that python is quite old, older than Java - 1991).

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

#524
I can't imagine a better output for llms than python. not because its particularly good. far from it, its got dynamic typing and more or less sets you up for runtime failure. however, it has probably the largest corpus of training data aside from javascript.

Part of my worries that all this push to LLMs will marginalize niche programming languages from being used in startups since the lack of training data means falling back to hardcoding. a skill that I have a feeling will get increasingly niche overtime. I feel capitalism will basically render programming languages into a build artifact overtime.

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

#525

And with AI writing code, why use libraries, which makes us more vulnerable to 0-day attacks? Our simulation core components are pure Fortran, no libraries, all written by Claude/Cursor/Codex.

I remember when having as little code to maintain as possible was an engineering goal. My professors were adamant that code reuse was a virtue. I had "less code = less bugs" drilled into me.

I'm sure the new way is better though, given how much my boss seems to be tracking my token usage these days...

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

#526

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.

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?

#527

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…

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

But it's LLMs that read it not humans. At least that's the trend

> Use a language that has a large training set so the LLM can be most efficient.

It's pretty efficient with Rust.

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

#528

Earlier quoted context omitted.

Just use Go. LLMs have seen a ton of it, they write it well, it compiles practically instantly, and it has all the advantages of a typed compiled language. I created a big Python codebase using AI, and the LLM constantly guesses arguments or dictionary formats wrong. Unit tests and stuff like pydantic help, but it's better to avoid that whole class of runtime errors altogether.

But what is the selling point for Go? I get that it is allegedly hailed to be a simple language with basically no batteries included, but why is that a selling point? Does Go excel at anything no other language does?

1. It has first-class co-routines, so supports high concurrency without having to deal with async bullshit

2. It produces a dependency-less statically linked binary

3. Duck typed interfaces give you static typing with minimal ceremony. They are implemented even for types outside your own code base, which is a common pain point in Java or C#.

4. It compiles quickly

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

#529
post #13

For the utilities I write it is faster to iterate without having to compile. When I get to the point where I'm done adding changing features, and performance is an annoyance I can always ask the AI to "rewrite this in Go". (I've never gotten to that point.)

    > it is faster to iterate without having to compile
I hear this sentiment from time to time. With a modern PC, IDE and Java or C# development toolkit, incremental compile times are insanely fast, even on very large projects. I can say with first hand experience: You can iterate as fast as Python. I don't know enough about Golang to say the same.

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

#530
post #2

Bit off topic but why in the world are people still posting on medium? The reading experience is abhorrent; I couldn’t even finish reading this article before a full screen popup literally blocked the sentence I was reading. Is there some incentive I’m not seeing?

It's a free, permanent host for your blog articles with a built-in community and monetization layer. There's only so many free hosts out there that I'd be confident will be around in 5 years, and Medium is one of them.
Post reply on HN