Live data from Hacker News

If AI writes your code, why use Python?

medium.com

871–880 of 1001 posts

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

#871

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…

I'm assuming you use Emacs? Are you using a special "hacker news mode" or something more generic?

HN threads is probably not the best example because the site is pretty readable already. But it's not that difficult to fetch a thread and render it in the Org-mode outline format. nhreader.el¹ does that. For reading articles I just use eww. it has (eww-readable) that removes all the fluff like banners. The trade-off that eww (by design) doesn't do any javascript. That makes it difficult to use with websites with client-site rendering (React, et al.). For that, I have a little automation elisp² that uses OSA (JXA) and extracts the rendered content off the page. I need to figure something similar for Linux, but it's not so straightforward, the only way I know is to run the browser with the debugger port.

¹ https://github.com/thanhvg/emacs-hnreader

² https://github.com/agzam/.doom.d/blob/main/modules/custom/we...

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

#872

Earlier quoted context omitted.

As far as the AI is concerned, it's more like Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo versus Buffalo:PN buffalo:N Buffalo:PN buffalo:N buffalo:V buffalo:V Buffalo:PN buffalo:N I think the second one makes much more sense.

In the rare case that all your concepts use the exact same descriptive word, you are probably right! The majority of the time you can infer the type from reading well written code (to the extent that the shape of the type matters in the context of that piece of code)

[deleted]

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

#873
I think this is mostly right, if we only mean "writing code." AI makes it much easier to write code in languages I would not have touched before. But the hard part is still deciding what should exist, what should not exist, which edge cases matter, how users will misunderstand the UI, and what mess you are leaving for future maintenance. So yes, AI weakens Python's "easy to write" advantage. But boring ecosystems, docs, deployment, debugging, and libraries still matter a lot. Even PHP still matter a lot to me...

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

#874
+1 for Go! it's my go-to language for any new project at the moment. It's simple, idiomatic, has no awaits, fast compile times, static typing, and it is very opinionated, which helps a lot because agents "subconsciously" follow these standards. Comparing it to TS, it's like day and night; a TS codebase rots at the speed of light...

I also created a guardrails library (inspired by Java's ArchUnit) to prevent code rot - https://github.com/ksanderer/goarch. It helps enforce code standards, decouple the codebase, prevent cross-module imports and crashes builds with concise error messages for agents to fix problems early, very nice experience

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

#875

Earlier quoted context omitted.

As far as the AI is concerned, it's more like Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo versus Buffalo:PN buffalo:N Buffalo:PN buffalo:N buffalo:V buffalo:V Buffalo:PN buffalo:N I think the second one makes much more sense.

In the rare case that all your concepts use the exact same descriptive word, you are probably right! The majority of the time you can infer the type from reading well written code (to the extent that the shape of the type matters in the context of that piece of code)

If the type can be inferred by the reader it should be inferred by the type system and at least be available to the LLM as a query. But we're also talking about dynamic languages in which type cannot be inferred until runtime. What's the type of x?

x = y + z

Well that depends on the types of y and z, which themselves may depend on the types of other operands, which themselves may not be known until the program actually runs. All that inference takes a lot of thinking, which takes tokens, which cost money. Why not just write the types down? Although we call these things "inference engines" they're really pattern matching explicit tokens, so it's better to actually write down the types so they can be pattern matched than to figure them out at inference time.

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

#877

Earlier quoted context omitted.

I think most people agree with you -- that's why. Also because I'd say most programmers don't care much about maintainability or quality. I personally find that AI writes better Scala than Python.

Before AI, I used to say types reduce quality by wasting dev time that could've been spent on testing. They may also encourage overly complex code. With AI, I don't know. If we're forced to use types, the AI does that work for me, but that added verbosity can't be good for it.

It's sort of an open question how LLM authored code will stand up over the years/decades. It's a lot of code, but maybe the capabilities for reading lots of code will also improve, or maybe the way human shops can snarl up in giant balls of mud that are terrifying to work on, the rate of change for a given system authored by LLMs will show an S-curve shape rather than staying responsive to changing conditions or whatever.

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

#878

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…

As much as I dislike writing Go, I think it's pretty close to the ideal LLM language. There's usually one very obvious correct way to accomplish things, there's a ton of training data, it's GC'ed, the standard library is expansive and of good quality, there's a large ecosystem of 3rd-party packages, etc.

About the only place where I don't think Go works for agent-heavy workflows is that it's not very concise. It takes a lot of Go code to express what other languages can do in many fewer lines, and I think this wastes Context Window but also just makes it harder to keep everything in my poor little human brain.

LLMs also do a pretty good job writing modern C++.

I much prefer writing Common Lisp but I've noticed that LLMs (claude 4.6+ and GPT 5.x) aren't nearly as good at writing Lisp than they are at more mainstream languages, plus Lisp's syntax makes it a little hard to read sometimes, especially if you're not in the habit of reading it every day.

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

#879

Earlier quoted context omitted.

> Why would I do that, if I can easily extract all the relevant, plain text (and even structured one) and read it in my editor instead? Because that’s an enormous pain in the ass. Not scalable at all.

Its pretty easy with a system like Readwise. Yes, that's ANOTHER system, but its one system to quickly just add articles like these to an inbox and read them another time, in plain text. Of course, it doesn't work 100% and certain sites are hostile to it and do stupid javascript tricks "for the views". Mostly, I use it to put it on a reading list later, and to get around really, really abusive ad driven sites.

> Its pretty easy

100%. One can use mozilla/readability to extract the content. Even if you think that would require some effort, think about it - you have to do it ONLY once and never deal with that kind of annoyance EVER again. It really baffles me seeing devs complaining about shit like that. Why? Why won't they figure out a better way? You're a friggin' programmer - computers have to obey your will. You spend your lifetime staring at the screen, reading and editing text. Why not do it on your own terms? Even if it takes some effort, why choose to be henpecked by someone else's rules FOREVER?

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

#880

What are some concise languages that are well received by humans (on par with Python)? Token efficiency might be a marked advantage. Clojure comes to mind at least.

https://martinalderson.com/posts/which-programming-languages...

This article claims that Clojure is the most token efficient language.

Post reply on HN