Live data from Hacker News

If AI writes your code, why use Python?

medium.com

661–670 of 1001 posts

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

#661

No reason, unless the project is simple. The more you can offload onto your compiler/typer - the shorter is the feedback loop, the better agents work. Lack of strictly enforced static typing make agents fail much sooner with Python. In my opinion, Rust and Scala are the best targets for agentic flows - and, coincidentally, they have the most advanced typers among mainstream languages. But any statically typed languag…

I feel like types doesn't really make a difference in this context. Types are good for enforcing standards between in a multi human situation, but AI doesn't really make the same mistakes that warrants it.

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

#662
I'm not fond of functional languages. It isn't that I don't get why they are a really good idea (they are). I just can't stand the syntax, the lack of proper standard libraries, and the lack of mainstream-big-ecosystem'ness. Mainstream languages are nice because there is lots of code, documentation, discussion and I can find people I can talk to. And you can write real code in situations where you may not be the one to maintain it 10 years from now. Or 5. Or 2.

Agentic coding changed that. A bit.

I still dislike most functional languages because my brain doesn't work with their syntax, but these languages are REALLY good targets for agentic coding.

I'm a backend developer who occasionally needs a frontend slapped onto something. So I have been through all the usual suspects. Angular, React, Vue. All terrible reminders of why I try to stay away from the frontend. Touch it and you roll around in tons of dysfunctional tooling, weird complexity and gimmicky mechanisms that are ridiculously fragile. It isn't just as if a bunch of cats wrote the code, but they are feral cats. And if you point out just how messy things are, they just hiss at you and piss on your shoes.

And then I discovered Elm. Not only does it not crap all over my git repository, LLMs love Elm. Yes, it poops out a JS blob. But I don't have to look at it. I can just pick it up with my long tongs and drop it into my server using embed.FS in Go.

Perhaps I should overcome my peculiarities and love Elm too.

Anyway.

Anything that can make Python go away I'm for. It is not for writing programs that will ever leave your workstation and be inflicted on others.

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

#663
post #641

Earlier quoted context omitted.

> AI makes Rust development go 10x faster. The borrow checker isn't even an issue. It's invisible now. What happens when things break and the AI agent can't fix it?

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?

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

#664
post #479

Earlier quoted context omitted.

I never really understood what exactly is so readable about python. I've been developing in Python for 8 years now, and before that I was a C# developer, and I don't find Python to be that more readable. Sure there's less ceremony, and yes, you can have your project going with just a single file, but other than that...?

People confuse having fewer keywords/concepts to learn for readability, which is not really the same thing. Someone who is equally expert at Java and Python will probably consider Java to be more readable.

The concept of "readable" is not really relevant for experts, because, well, they are experts. Being an expert automatically means you can read almost any line of code and know everything it does.

Everyone else appreciates and is more efficient working with code that is intuitive to grasp.

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

#665
post #661

No reason, unless the project is simple. The more you can offload onto your compiler/typer - the shorter is the feedback loop, the better agents work. Lack of strictly enforced static typing make agents fail much sooner with Python. In my opinion, Rust and Scala are the best targets for agentic flows - and, coincidentally, they have the most advanced typers among mainstream languages. But any statically typed languag…

I feel like types doesn't really make a difference in this context. Types are good for enforcing standards between in a multi human situation, but AI doesn't really make the same mistakes that warrants it.

Models are trained on human data and they make exactly the same mistakes - and a lot of mistakes humans don't usually make.

Also they are extremely bad at high-level design.

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

#667

No reason, unless the project is simple. The more you can offload onto your compiler/typer - the shorter is the feedback loop, the better agents work. Lack of strictly enforced static typing make agents fail much sooner with Python. In my opinion, Rust and Scala are the best targets for agentic flows - and, coincidentally, they have the most advanced typers among mainstream languages. But any statically typed languag…

>Lack of strictly enforced static typing make agents fail much sooner with Python.

Just tell your agent "Use type hints. Add a pre-commit hook to run ruff, black, mypy, and pytest." It will save you 99% of headaches.

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

#669

Earlier quoted context omitted.

The tools the language gives you to create those abstractions make a lot of difference, however.

But every abstraction that an LLM has to write is a choice. Your way of writing Python may not match that choice. The next run of the agent might not choose the same way. Because the language gives you many different tools, an LLM generated codebase can get inconsistent and overly complicated quickly. The flexibility of Python is a downside when you’re having an LLM generate the code. If you’re working in an existing…

To me applying LLMs to a python (or similarly dynamic) code base where it’s currently spaghetti and monkey patched, it can miss things just like I can.

But… I have to admit Opus 4.7 has been very pragmatic in detecting root causes and proposing sensible fixes to bugs in this situation (ie bugs encountered in production not compile time).

It’s also fine at matching current styles and conventions (which is great if they are good styles and conventions).

In terms of new code, rust would have been near impossible to write with such a high degree of non-local reasoning, so I’m assuming these bugs wouldn’t be present.

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

#670

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…

Haskell is more readable. It looks just like pseudocode. Change my mind.
Post reply on HN