Live data from Hacker News

If AI writes your code, why use Python?

medium.com

701–710 of 1001 posts

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

#701
post #533

Earlier quoted context omitted.

Python and C are the only language in which I have experienced that class of bugs. And that is due to if statements without brackets in C and because Python has meaningful indentation which people have accidentally messed up when refactoring. And today with autofotnatters I think only Python is still vulnerable.

If you are messing up indentation accidentally during refactoring there is either something wrong with your tooling (including your text editor) or you are letting things get too far out of hand before starting the refactoring.

It's 2026. I'm using Jupyter notebooks in Databricks. Guess what my tooling (including my "text editor", the Jupyter notebook), does not do?

Yes, I can castle-[ to shift a block of code left or right, but this is not always problem-free nor is it automatic nor does it have any sense of where the indents should go.

Yes, there is a "format python properly" button which often errors out says "there is an indentation error in your python so I cannot automatically indent it"

Would I like to use better tooling? I present my .vim file as evidence. Am I using what they tell me is state of the art? yes. And in 2026, state of the art does not solve python indenting, because python indenting is inherently a broken paradigm

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

#702

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 would argue that you should use python if the LLM is writing code for a non-programmer to understand and contribute to. Ie: things like notebooks.

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

#703

Earlier quoted context omitted.

Rust is a fantastic language to emit from AI. Studies report that the language design tends to result in lower defect code (vs peers such as Go and Java) due to how the syntax aids error handling, logic flow, and API design. You don't need to know Rust to begin using it. You'll learn it quickly enough. The code is easy to read, and Serde makes parsing, especially JSON, extremely pleasant. Writing HTTP services is a b…

What study? And I don't see how Go design patterns would be any worse. The main issue people have with it is the repetition/verbosity, which LLMs handle just fine.

The repetition and verbosity makes it more expensive for the LLM to write. You'd want a language that is expressive and dense if you're optimizing for token usage.

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

#704

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?

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.

I like C#, it's how I make a living, but it's way too large today. I can program in valid C# and it looks like C or I can program in C# and it looks like a functional language or I can program in C# and it's looks all angle-brakety like C++.

The problem with that is everyone has an opinion on what good C# looks like.

For personal projects, I'll take a much simpler language any day.

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

#705

Earlier quoted context omitted.

I would love to see how they do with functional languages and especially Lisps here. I've noticed pretty good performance with Emacs Lisp relative to overall model strength, but I haven't used LLMs to application code in any such languages. It would also be interesting to see how Python compares to other languages in its niche (Ruby, Perl, Raku). Thanks for putting this together! It's interesting.

I've noticed that with clojure(script) unless you specifically instruct them to keep nesting levels low, they can hit a point where they make a paren placement error and can't debug their way out of it. Although in my case while one model made the error then couldn't find what it had done, a second model that I switched to was then able to identify it and back it out. So I suspect this is a transient weakness in toda…

That's because you are holding it wrong. Just replace the ( with rs, like in strawberry.

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

#706

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…

There's a huge difference between a program which can be verified as correct by static analysis, and a program which can only be verified as correct by running it. Python is the latter (though maybe in between with gradual typing). The iteration loop just collapses when an agent is driving an LSP in a statically typed language.

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

#707

Earlier quoted context omitted.

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

Indeed. Python is faster to write and harder to maintain over the long run. The "faster to write" advantage becomes less relevant if most code is going to be auto-generated. The "harder to maintain" might still remain more relevant.

>harder to maintain over the long run.

First off, this is begging the question. Second, if you never get to a point where you need to maintain something, who won?

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

#708
post #649

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…

What if you want to offload a lot of the work to libraries rather than generating (and presumably reviewing?) it yourself? Python has a very strong ecosystem of useful libraries because it's been around so long and is popular in a number of application domains.

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.

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

#709

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.

Abstractions are created to improve local comprehensibility. They introduce a cost for global comprehensibility.

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

#710
post #221
post #76

If AI writes your articles, why use brain?

You sneer but the models are much better now than last month and token costs are down! LLMs are just like compilers for the brain! /s

Just like human typesetters who mucked around with silly metal cubes were replaced by more efficient word processing software, human writers who muck around with silly words will be replaced by AI. Future writers will work at a ~higher level of abstraction~ :sparkle:

"Claude1, find the most popular topic online", "Claude2, write a blog about that", "Hmm hmm good, but can you make the title more punchy?", "Claude1, fact check and report back to Claude2"

Post reply on HN