Live data from Hacker News

If AI writes your code, why use Python?

medium.com

811–820 of 1001 posts

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

#811

The static vs dynamic language debate is decisively over and static has won. I called this out back in 2023, and I've only become more convinced since then. Statically typed languages are easier for the reader because you can see the types and quickly jump to their definitions (or even just hover over them in some IDEs). They're easier for the AI because they provide natural guardrails and feedback to guide it, as we…

Strong typing has clearly won. However, verbose typing is likely a negative for LLMs. Algorithms written in "pseudo-code", aka a higher level language without type information, are far more readable to a human, and thus likely an LLM too. In regards to control flow and general concept of what code is doing, types provide very little info over well named variables. In fact they often impair understanding by breaking u…

> Algorithms written in "pseudo-code", aka a higher level language without type information, are far more readable to a human, and thus likely an LLM too.

What’s the basis of this claim? There are many many more lines of code LLM’s are trained versus pseudo-code.

Also I agree, anecdotally the self-correction is key benefit from static types. If there is a mistake, it is caught at compile time and not at runtime.

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

#812
maybe now isn't the time but at some point it needs to be better understood which models are best for which types of programming or styles or languages. These models are not all the same for every language. The harness is also a factor. Python seems to be somewhat an exception today but that may not last. Another question might be: is there a pattern where you prototype in language X and implement in language Y. The models seem to be very good at porting code. I've used this pattern with python -> c++ SDL to squeeze out performance after I had a working gui. Has anyone measured this in terms of speed (wall clock) and in terms of token efficiency?

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

#813
post #710
post #221

Earlier quoted context omitted.

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, fa…

Now do it with code

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

#814

The static vs dynamic language debate is decisively over and static has won. I called this out back in 2023, and I've only become more convinced since then. Statically typed languages are easier for the reader because you can see the types and quickly jump to their definitions (or even just hover over them in some IDEs). They're easier for the AI because they provide natural guardrails and feedback to guide it, as we…

LLMs are amazing at golang. They seem to have great training in the k8s world, so writing custom controllers and operators takes minutes instead of days now.

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

#815
post #270

Earlier quoted context omitted.

I honestly think Mojo is the dark horse in this race. That is assuming all the roadmap goals are fulfilled. We're talking about C++-like performance, Python syntax, complete compatibility with Python, designed from the start to interface with AI, compile-time metaprogramming like Zig, and all kinds of other goodies. So yes, people can bless Go and Rust all they want. Nothing is wrong with the languages, but I agree t…

I really wanted to like Mojo, but the more I read about it, the more it really wasn't Python even though, starting out, that was a major claim to fame. There is an excellent chance it will be awesome stuff. But they did themselves a huge disservice with the initial claim about trying to be Python compatible.

There is still Python Interop., which will be nice. Even if the syntax is not a one-to-one, it's better than nothing. Though, I do agree "100% compatible syntax" was an overzealous promise.

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

#816
post #49

Earlier quoted context omitted.

Go is fun, you should actually learn it

Oh man... I like go because it is compiled, performant, strong and statically typed. But "fun" is not something I would say about it. The ergonomics of error handling, lack of ternary operator and other stuff that compiled 30yo languages already had ...

Idk, I'm having fun with it. The good outweighs the bad for me, and idk why people get so bristly about handling errors, it's more straightforward to debug than nested try/catches

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

#817
post #323

Earlier quoted context omitted.

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?

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.

Not my words, lol. It's what people say about the language. But thank you, this was the type of answer I was looking for.

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

#818

Earlier quoted context omitted.

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

Python has a quite random collection of stuff, and it's often quite low quality and people don't use it anyway. I wouldn't say it is close to Go. I haven't used Java for a decade or so but as I recall its standard library was pretty bare bones (similar to Rust). Apparently C# has a pretty comprehensive standard library but I've never used it.

> Apparently C# has a pretty comprehensive standard library but I've never used it.

I use C# more days than not. The comprehensive standard lib is impressively large and accomplished everything I need. Third-party libraries is a real pain point though. I haven't looked in sometime, but things like sane PDF libraries, reporting libraries, etc. were severely lacking when I needed them last. As much disdain as I have for Java, I think it is better in that regard.

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

#819

The static vs dynamic language debate is decisively over and static has won. I called this out back in 2023, and I've only become more convinced since then. Statically typed languages are easier for the reader because you can see the types and quickly jump to their definitions (or even just hover over them in some IDEs). They're easier for the AI because they provide natural guardrails and feedback to guide it, as we…

Agree 100%.

In the early days (before Claude Code mastered Rust,) I would get into this annoying pattern where Claude used different names for variables between tests and implementation, get confused, and then more times than not, would change the implementation to match the test (which was not written first--was not doing TDD and thus not the behavior I wanted.)

Static languages prevent that. I've had great success with Claude writing Rust, and I think it's an excellent language for LLMs not just for low level work, but for production-grade code of all types (I see rust as better aligned to compete with C++, Java, and C#.)

I've also had great success with Claude writing C#. Using Claude, I've built C#/.Net in Linux, deployed in Windows (via Visual Studio) with Claude Code running in WSL, and it's been a great experience all around.

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

#820

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

Locally readable is what I want for LLM-generated code, though. If I need to change the whole architecture, I re-prompt the LLM and have it rewrite the code for me. The changes that I'd need the code to be human-readable for are quick fixes where the LLM got something simple wrong and it'd take longer to explain to the LLM where it went off-track than to just fix it myself.
Post reply on HN