Live data from Hacker News

If AI writes your code, why use Python?

medium.com

601–610 of 1001 posts

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

#601
post #479

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…

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

" and before that I was a C# developer"

So .. you were already trained in reading abstract.

A beginner on the other hand sees lots of intimitading {} in C family languages everywhere. And Python does not need them and less is usually better in design.

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

#602
post #564

Earlier quoted context omitted.

So I can test my feature today instead of waiting until it finishes compiling tomorrow.

this is the top reason for a reasonably complex project, but it can be worked around by preplanning crates. the other reason is if you really want async as is in vogue nowadays, function coloring - but this is rapidly becoming irrelevant, see article.

> but it can be worked around by preplanning crates.

Maybe if you're working alone.

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

#603

Python might still be the best option if your goal is to perfectly one shot the solution and minimize token usage as much as possible. However, if you are willing to stub your toes, retry, and pay more money, an entire new world opens up. Languages like python seem to fall apart faster in extremely large projects. I've got a collection of interdependent .NET codebases with about 50 megs of raw source between them. Ha…

Yes, roslyn is like a super-power for agentic coding.

At work we have a custom disposable data provider that gets into trouble if you use async/await inside it.

Traditionally this was enforced through oral history, but with agents this needed addressing.

It was actually really easy to write a custom analyzer which can pick up whether `await` is ever called within the scope of this provider and fail the compilation.

The only thing you have to be careful of, is making sure the LLM doesn't sneak in some "ignore Rule CUST001" pragma blocks, but it's mostly good about not doing that, unless it thinks you're "prototyping", in which case it seems to treat errors as inconveniences to be worked-around.

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

#604
post #549

Earlier quoted context omitted.

Would be interesting to find out what kind of production systems you write in Java and how you deploy / scale them. What DB backends you use, caching, etc. And whether you're also on Spring.

Always finance, trading systems. In the last 15 years mostly what they call "front office". At the moment, for the place I work, we deploy on AWS mostly (because that is where our target trading venues often are). DB backends are largely not something we think about too much, because all of that is done out of band of course as a final state. Our main persistence is through our "bus" using aeron, and everything start…

Ok that's quite interesting. Am I correct to presume this is crypto trading? I was under the impression most regular HFT is near the exchanges, or physically at the exchange in a DC. Unless it's an AWS Outpost or something.

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

#605
post #584

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.

Haskell does not qualify for a large training set, though. (Nor for readability in my opinion) I think I have never seen haskell software made wih LLM's but well, aside from university, I have not seen Haskell code at all. (Also Haskell purists I would associate with people who avoid LLM's) I would rather go with Rust given these choices. But I have good results with typescript (or javascript for simpler things). Rea…

[dead]

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

#606

Earlier quoted context omitted.

Let's say you get access to a microservice from another team in the company. Do you read through and audit every line of code? What if it's from an external vendor? A 3rd party SaaS? At which point do you stop caring about reading every line of code you run?

This is perhaps where our perspectives differ, because I see the usage of LLMs not as an external third-party (another team per your example), but instead as an extension of one's self. Given that lens, I'm highly sensitive to the quality and function of its output, because ultimately its contribution is my responsibility. I appreciate not everyone feels this way, but that's why I personally would be anathema not to…

My philosophy is just to Duck-type the program: "If it walks like a duck and it quacks like a duck, then it must be a duck"

I don't care if the duck is wet spaghetti inside, it does what I need it to do within the parameters I can measure.

If it fails to quack or walk later on, I have production alerts for that and I'll deal with it then.

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

#607

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.

I’m curious about the design space of languages & frameworks which are lower level than LLM prompts but higher level than Python, Ruby and Common Lisp. Do you have any recommendations for systems where reasoning about large systems is easier than in python?

You have to go into live programming, code in a system, and saving images. Readability is no longer a factor, what you want is easy access to documentation, quick navigation, and a playground.

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

#608

My experience is that there's a correlation between powerful type systems and the property that once your program compiles, it's correct. Compiles == correct is rarely true in C or JavaScript. It's often true in Haskell and Rust. TypeScript is somewhere in between C and Rust. There's a niche available for a language which is relatively easy for a human to read, but with a very powerful at the expense of difficult to…

>My experience is that there's a correlation between powerful type systems and the property that once your program compiles, it's correct. Compiles == correct is rarely true in C or JavaScript. It's often true in Haskell and Rust. I find this staggeringly hard to believe. Most bugs are logic errors. How does Rust or Haskell prevent these?

> Most bugs are logic errors.

Are they? IME most bugs are type errors.

Or rather, IME most bugs are logic errors only because I've excluded the possibility of type errors by using a sophisticated type system.

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

#610

Earlier quoted context omitted.

Just last night I was going down the rabbit hole of "what's the best programming language to use for vibe coding." I came to a short list of: a) Typed Racket b) OCaml c) Julia I would love to see those three added to your benchmarks. And Mistral Medium 3.5 added to the LLM list, please.

Thanks for the recs, we will look into adding some of these, maybe OCaml for variety. I'm not familiar with Racket. Mistral Medium 3.5 is on there, but you will have to scroll down pretty far to find it (does not perform well): https://gertlabs.com/rankings?mode=oneshot_coding

Racket is a variety of Scheme that grew up as a teaching language, but now also has a few other notable niches as well.

Typed Racket is to Racket as TypeScript is to JavaScript: it adds some additional static checks to an otherwise dynamic language via gradual typing. This pair of languages might help begin answer the question "does gradual typing generally help LLMs, or does TypeScript outperform JavaScript for incidental reasons?".

Among Lisps, I'm most interested in seeing Clojure because it's a language I can see myself using with LLMs at work. But Typed Racket and Racket could make an especially interesting pair because of the gradual typing thing.

I'm not sure whether you want to include them in your project. The kind of selectivity you describe yourself as going for is hard for me, especially since I'm not the one doing the work. :)

PS: Aside from this benchmarking and comparison project: Racket is an interesting language and seems like a good place to start if you want to explore classic Scheme texts (Structure and Interpretation of Computer Programs, The Little Schemer, How to Design Programs) or newer ones that try to teach newer or more specialized ideas (e.g., The Little Typer). You may have to tweak the language a bit to stay faithful to some of those books, but that's something Racket is good at and there are already sources noting relevant differences online.

When a non-programmer in my life expressed curiosity about programming, we ended up starting HtDP together and it's been fun. I think Racket was a good choice for that.

Post reply on HN