Live data from Hacker News

If AI writes your code, why use Python?

medium.com

881–890 of 1001 posts

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

#881

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…

This is a lot of speculation with absolutely nothing backing it.

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

#882

Earlier quoted context omitted.

> It's supposed to display content according to the preferences of the user. That's right, the original idea was exactly about that, but like I said - in practice that is no longer a thing. Using the editor for reading any content is enormously underrated. Check this out - this entire thread opens in my editor as an outline with nested structure. Meaning that all the regular outline operations are available to me - f…

Can you share your setup how to achieve what you described? I'm curious.

see the adjacent thread

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

#884

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…

> ... something you know well and is easy to read ...

For this reason I tell my LLMs to use Ruby whenever possible. In one rare case where the performance of my script was critical, I told Claude to convert the working ruby script to Rust. It got it right in a single shot.

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

#885
post #843

Earlier quoted context omitted.

Name one of those abstractions that is missing in Python.

You joking? - strong typing - real concurrency (heaven forbid you want a background task without having to spool up an external message queue and worker) - immutability - limitations in error handling (sort of just typing really) - limitations in nullability (also typing) - memory layout is usually hidden or abstracted away - no actual private methods or classes That's far from a complete list, but maybe you're takin…

you probably mean that python is not static typed.

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

#887
post #843

Earlier quoted context omitted.

Name one of those abstractions that is missing in Python.

You joking? - strong typing - real concurrency (heaven forbid you want a background task without having to spool up an external message queue and worker) - immutability - limitations in error handling (sort of just typing really) - limitations in nullability (also typing) - memory layout is usually hidden or abstracted away - no actual private methods or classes That's far from a complete list, but maybe you're takin…

> strong typing

Python is a strongly typed language. Strong and Static typing aren't the same thing.

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

#889

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 also has a rather high number of footguns, which is not a feature of other equally-capable languages.

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

#890

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.

If you're going to go Haskell, why not go all the way to Lean 4 and get mathematical provability along with reasonable speed and type-safety?
Post reply on HN