Live data from Hacker News

If AI writes your code, why use Python?

medium.com

711–720 of 1001 posts

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

#711

Earlier quoted context omitted.

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?

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.

Wouldn't a LLM just produce a massive type gibberish long term?

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

#712
> Nicholas Carlini, a researcher at Anthropic, orchestrated 16 parallel Claude agents to write a production C compiler in Rust.

To write a proof-of-concept C compiler, not a production-grade one...

Hard to take the article seriously after this

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

#713
Because if you still need to read your code and understand it, it should be in a language you are comfortable with. And yes, you still need to read your code and understand it. If that's rust, good on ya. But if that's Python -good on ya too.

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

#714

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 does have a huge training set, but I figure lots of that training comes from disciplines where maintainability or system design isn't as heavily incented. Reports, notebooks, dashboards, etc.

My early experiments with LLM Python seemed to give me that impression, but I'm wondering if it's better now or people have other experiences.

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

#715

Earlier quoted context omitted.

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

I've tested many flows involving linters. Results are far from ideal - agents tend to work around linters, mass-add ignore annotations, etc, especially in situations when fixing one warning/error triggers another (and that happens regularly).

What if we tell the agent NOT to add ignore annotations (or to ask about them if there's no other reasonable way to proceed)?

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

#716
post #690

Low bar critiques: > For the last decade, fast-to-ship beat fast-to-run. Not anymore. Fast-to-ship didn't beat fast-to-run, it was "beating" "quality built software." It still is. Beating here implying that it's the focus of companies. > picked a harder, faster language Go is absolutely an easier/simpler language than JS/TS. > The Python ecosystem is increasingly a Rust ecosystem wearing a Python hat. The Python ecos…

> Go is absolutely an easier/simpler language than JS/TS.

You're suggesting that a language with concurrency is simpler/easier than a language that does not have concurrency.

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

#717

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.

Wouldn't a LLM just produce a massive type gibberish long term?

I've "written" a lot of rust via LLMs, and the rust tooling and features give a lot of useful guard rails to LLMs that produce pretty good code overall, certainly compared to the python I've seen it crank out. Clippy and fmt alone often cause the LLM to hit a snag and realize it's mistake and take a better approach. It's quite a powerful combo IME

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

#718

> Nicholas Carlini, a researcher at Anthropic, orchestrated 16 parallel Claude agents to write a production C compiler in Rust. To write a proof-of-concept C compiler, not a production-grade one... Hard to take the article seriously after this

To be fair it was a totally unattended zero shot loop developed compiler - which is pretty remarkable no matter how you cut it.

I’m surprised what made you quit reading wasn’t the Claude voice sneaking through their half success attempt voice clone.

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

#719
post #319

Earlier quoted context omitted.

Yeah C# is fantastic. I also love EF. I stopped using it because overall it feels like Microsoft has lost the plot with .NET.

What I hate about .NET is the atrocious naming. Net Core, Net Framework, Net Common Core, .NET.. And God forbid any of these frameworks ever expose what they are in a config file. You start a project, hand it to a colleague and he can't figure out whether it's Framework or Core by looking at the files. You Google and are immediately bombarded by 15 year old threads.

Forget about the old stuff; just use .NET 10.

It's really, really good now. DX is fantastic. Yes, the hot-reload will probably never match that of interpreted languages, but for a compiled language, it is good.

File-based apps are easy to get started with: https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals...

EF is solid and proven. Easy, low-lift type safety end-to-end from DB up with very good perf.

Tooling is dead simple and consistent; `dotnet build`, `dotnet test`, `dotnet run`, `dotnet ef database update`, `dotnet ef migrations add`, `dotnet tool restore`. No mix of build tools and toolchains.

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

#720

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?

goroutines make building scalable network (web) servers trivial and fast. I'm not a big fan of the language, but the runtime is fantastic.
Post reply on HN