7 ms·
I was so into Python for 10 years, was enjoyable to work in. But have deleted 100k+ lines this year already moving them to faster languages in a post AI codebot
by brianwawok 5mo ago
I was so into Python for 10 years, was enjoyable to work in. But have deleted 100k+ lines this year already moving them to faster languages in a post AI codebot world. Mostly moving to go these days.
- shankysingh 5mo agoThats very intersting, If I may ask was it from professional projects or personal projects?
- mountainriver 5mo agoSame, I’m not sure how Python survives this outside of machine learning. All of our services we were our are significantly faster and more reliable. We used Rust, it wasn’t hard to do
- prodigycorp 5mo agothe funny thing is that everyone, including myself, posited that python would be the winner of the ai coding wars, because of how much training data there is for it. My experience has been the opposite.
- lexicality 5mo agoa lot of the training data is either for python 2 or just generally very low quality
- stuaxo 5mo agoThe quality issue doesn't seem unique to Python. The versioning issue I've seen across libraries that version change in many languages. I don't tend to hit Python 2 issues using LLMs with it, but I do hit library things (e.g. Pydantic likes to make changes between libraries - or loads of the libraries used a lot by AI companies).
- bigfudge 5mo agoI’ve found recent Claude to be much better in this regard. I think a lot rests on the quality of the harness and the work behind the scenes done to RAG up to date docs or search for docs proactively rather than guessing. I also don’t have issues with quality of Python generated. It takes a bit of nudging to use list comps and generators rather than imperative forms but it tends to mimic code already in context. So if the codebase is ok, it does do better.
- prodigycorp 5mo agoThat could be it. I still see LLMs fail a set of static typing challenges that I created a couple years ago as a benchmark. Google models still fail it. I wonder if the lack of typing in a lot of the training data makes python harder to reason about?
- lsbehe 5mo agoThe tons of python code would be great training data if there was any consistency across the ecosystem. Yet every project I've touched required me to learn it's unique style. Then I'd imagine they practically poisoned half the training set because python2 is subtly different.
- tyre 5mo agoI felt the opposite, because Python isn’t a great language. It won because of Google, fast prototyping, and its ML interop (e.g. pandas, numpy), but as a language it’s always been subpar. Indentation is a horrible decision (there’s a reason no other language went this way), which led to simple concepts like blocks/lambdas having pretty wild constraints (only one line??) Type decoration has been a welcome addition, but too slowly iterated on and the native implementations (mypy) are horribly slow at any meaningful size. Concurrency was never good and its GIL+FFI story has boxed it into a long-term pit of sadness. I’ve used it for years, but I’m happy to see it go. It didn’t win because it was the best language.
- groundzeros2015 5mo agoI’m always baffled when language complaints come down to syntax
- Ringz 5mo agoThat’s exactly how I think, too. But at the same time, I like indentation in Python, because I would logically indent in every other language as well. In fact, I find all those semicolons and similar things at the end of each line completely redundant (why should I repeat myself for something the compiler should do) and I hate them. And that’s despite having experience with Modula and 10 years of C++. But when I look at Rust, I find the syntax simply awful. From an ADHD perspective…
- eager_learner 5mo agofellow ADHD here. Rust feels like 'oh come on you want me to type all that?' I find Raku great, though
- krupan 5mo agoNot ADHD but 100% agree on rusts syntax. It's totally repulsive to me.
- krupan 5mo agoHave you never tried to read someone else's Perl code? Syntax matters. But complaining about indentation is silly. Other languages' compilers don't require it like python does, but the humans using those languages all absolutely require proper indentation. Why not make it part of the language?
- rplnt 5mo agoAI benefits from tools to verify its halucinations. That's much easier in a typed and compiled language. Then have a language that can't be monkey patched at runtime and the confidence increases even more. If you mean "easy to get something out of it" then yeah, it's great.
- nostrebored 5mo ago[dead]
- dkersten 5mo agoTypescript wins in terms of training data IMHO, by which I mean that the training data is large enough that AI does great with TS, and the language is (IMHO) superior to Python in many ways. I personally now use a mixture of Typescript and Rust for most things, including AI coding. Its been working quite well. (AI doesn't handle Rust as well as TS, in that the code isn't quite idiomatic, but it does ok)
- CuriouslyC 5mo agoIt turns out that volume of training data isn't the most important thing. Elixir beats Kotlin and C#, which beat pretty much everything else. Kotlin is probably the sweet spot for most things.
- dkersten 5mo agoNot the most important thing, but it certainly helps.
- eager_learner 5mo ago"sweet spot for most things." care to expand on this a bit? Thanks.
- CuriouslyC 5mo agoKotlin has the combination of JVM ecosystem, overall good performance and agents are good at writing it. I'd argue that it's a better default choice to reach for when working on non-frontend code than Go, though Rust and Python still have use cases.
- eager_learner 5mo agoThanks, that makes sense. I agree.
- eager_learner 5mo agoUpvoted you, because the downvotes from the Python cult are unfair.
- za3faran 5mo agoI wouldn't be surprised if static typing had something to do with it.
- LtWorf 5mo agoYou can test on the device directly, without needing to recompile to try something.
- deleted 5mo ago[deleted]
- deleted 5mo ago[deleted]
- ActorNightly 5mo ago[dead]
- amelius 5mo ago> We used Rust The problem with Rust is that you have to rethink your memory management architecture. I think Go is an easier choice.
- anthk 5mo agoProlog and Lisp will survive because contrary to LLM they know what reproducibility means instead of what LLM's slop around were by design they are stacking errors over time. AI can't compete against the classical AI where both Prolog and Lisp have tons of experience on contraint logic programming and expert systems. With AI you can throw up tons of RAM and VRAM (> $12000) and yet proper designs with Prolog with outperform these by a huge gap.
- deleted 5mo ago[deleted]
- physicsguy 5mo agoGo is terrible for scientific/ML work though, the libraries just aren't there. The wrapping C API story is weak too even with LLMs to assist. Try and write a signal processing thing with filters, windowing, overlap, etc. - there's no easy way to do it at all with the libraries that exist.
- LtWorf 5mo agoI think the purpose of go is to write CRUD. Stray from that and you're on your own.
- zem 5mo agocrud is a pretty poor fit for go, you're better served by languages like python that can autogenerate classes that reflect the db schema. go's sweet spot is things like network servers.
- luckydata 5mo agoyou just need the right tools https://github.com/CaliLuke/loom https://github.com/CaliLuke/loom
- mywittyname 5mo agoGo tooling has this kind of thing as well. I'm not a huge fan of go, but last time I had to work with it, we leveraged a lot of codegen.
- stuaxo 5mo agoThis is straightforward in the first instance, but how do you see maintenance of those projects going forward - especially adding more complex features ? I can see one way forward being to prototype them in python and convert.
- nostrebored 5mo agoIt’s completely the opposite. LLMs write awful python. Horrendous. They write pretty reasonable go and do it quite quickly. We started in Python because of “the ecosystem”. It was a mistake. The amount of time we spend ripping out each dependency and pruning it to what we need is way higher than if we’d spent the month building out what we need. I miss compilers and LLMs will NOT generate config driven code or things that serde well. Everything has layers and layers of adapters by default and the domain model slowly erodes over time.
- rbanffy 5mo ago> It’s completely the opposite. LLMs write awful python. Horrendous. I've been using Claude Opus and it's pretty competent. I rarely have to make steering corrections. Once I had to deal with confusion, but, overall, the code is neat and the approaches sensible. It all depends on how much context you give it to work from, for instance. If it's building on top of a well organized codebase with a good best-practices document, it performs just fine.
- deppep 5mo agoi don’t really see it this way. the value of a token in Python is much higher than it is in lower-level language
- BOOSTERHIDROGEN 5mo agoInterested in why you'd use Python in the first place? Advice for someone who knows nothing about programming - what would you suggest?
- NegativeLatency 5mo agoTry a few, pick what you like
- IshKebab 5mo agoIMO the main reasons people use Python are: 1. The very first steps are quite simple. Hello world is literally just `print("hello world")`. In other languages it can be a lot more complex. 2. It got a reputation as a beginner-friendly language as a result. 3. It has a "REPL" which means you can type code into a prompt and it will execute it interactively. This is very helpful for research (think AI) where you're trying stuff out and want to plot graphs and so on. IMO it is undeservedly popular, or at least was. Wind back 10 years to when it was rapidly gaining mindshare: 1. While "hello world" is simple, if you went further to more complex programs you would hit two roadblocks: a) the lack of static type checking means large programs are difficult to maintain, and b) it's really really slow. 2. While the language is reasonable, the tooling (how you install packages, manage the code and so on) was eye-bleedingly abysmal. 3. While the REPL did technically exist, it was really bare bones. It couldn't even handle things like pasting code into it if the code contained blank lines (which it usually does). However since it has become arguably the most popular language in the world, a lot of people have been forced to use it and so it is actually getting quite decent now. It has decent static types (even if lots of people still don't use them), the REPL is actually decent now (this changed very recently), and there's a new third party tool called `uv` to manage your code that is actually good. The biggest issue with it now is that it's still horrifically slow (around 50-200x slower than "fast" languages like C++, Rust etc). It is pretty unlikely that that will ever change. People always try to excuse this by saying Python is a "glue" language and you just use it to connect components written in faster languages, but a) that's pure "you're holding it wrong", and b) that only works in some cases where there are nicely separated "slow bits" that can be moved to another language. That's the case for AI for example, where it's all numerical, but for lots of things it isn't. Mercurial was a competitor to Git that was written in Python and lost partly because it was way too slow. They've started writing parts in Rust but it took them 10 years to even start doing that and by then it was far too late. > what would you suggest? It really depends on what you want to make. I would pick something to make first and then pick the language based on that. Something like: * AI: Python for sure. Make sure you use uv and Pyright. * Web-based games: Typescript * Web sites: Typescript, or maybe Go. * Desktop GUI: Tbh I'd still use C++ with QtWidgets. Getting a bit old-school now tbf. Also Rust is the best language of them all, but I dunno if I'd pick it as a beginner unless you really know you want to get into programming.
- zabzonk 5mo agoThree things I find unlikely about this: - You wrote 100K lines of code (I've worked on several large C++ projects that were far smaller) - You wrote those lines in Python (surely the whole point of Python is to write less code) - You deleted them (never delete anything, isn't this what modern VCS is all about?) But whatever floats your boat.
- dkersten 5mo ago> You deleted them (never delete anything, isn't this what modern VCS is all about?) The person said: "deleted 100k+ lines this year already moving them to faster languages" Are you saying that when you move code to another language/rewrite in another language, you leave the original languages code in your repo? They didn't say they deleted it from their git history. I delete code all the time (doesn't mean its "gone", just that its not in my git head).
- zabzonk 5mo agoWell, they deleted it from somewhere. As I assumed they were using a VCS I assumed they deleted it from that. Or are they really short of disk space?
- rcxdude 5mo agoIn this context I would assume deleting code to mean deleting it from the current version of the software, not removing from the VCS history entirely.
- dkersten 5mo agoDeleted from the current head/trunk of the repo, ie the deployed code. Deleting "from my codebase" doesn't imply deleting it from history or backups. Just that the code isn't present for future edits or deployments. The way you're talking, it sounds like you never delete code from your codebase. Do you just comment it out when you change a line to something else or replace a function with a new one? Just add new files?
- squirrellous 5mo ago
- sinpif 5mo agoI'm still on the lookout for a comprehensive Django-like web framework for go. That would be an instant hit for me.
- pennomi 5mo agoSame here. Django is my last holdout for Python. Everything new is go.
- sirsinsalot 5mo agoI've found JS/TS Web stacks equally lacking and ugly after Django. I'm totally spoiled by a decade in Django. Just let me build a CRUD app, on the server, that spits out HTML without an excessive swamp of unmaintained nonsense and a cultish abhorrence of simplicity.
- andersonpico 5mo agowhat do django do that's contrived in js or say aspnet or rails?
- sirsinsalot 5mo agoWork
- seabrookmx 5mo agoTry another language? The Go ecosystem tends towards libraries as opposed to "frameworks." I personally chose C# for this reason, because ASP.NET is mature and (IMO) well designed. But there's also Java/Spring and and lots of other options in different languages depending on your preferences.
- sirsinsalot 5mo agoWell it might prefer libraries but the culture around basic DX things like ORMs is toxic. Just write the SQL yourself they say, until they themselves optimise to a half baked in-house ORM of their own.