Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I used to love Python, back when it was basically just an alternative to perl for scripting. Now it strikes fear into my heart when I encounter something largish written in Python because it usually means "super slow bloated researchy untyped ai/math code that's a nightmare to work with"




There are two types of people who use python: those who understand statistics and those who write python.

I’m happy that python basically took over the role once filled by matlab, and I’m happy that it became the leader in AI dev instead of something worse (probably Java if gpt2 had hit 5-10 years earlier).

But you’re right. It’s not fun anymore. It feels more like a pseudolanguage for expressing tensors now, because of the influx.

I’m exaggerating only in feigned outrage. In my actions, I’ve been coding in rust, go, and zig ever since ChatGPT came out.

I think that moment made me value python less. When I think about why, it’s because python became less challenging, and the problem space shrank.

It’s been fun to go back to low-level and remember how computers actually work.


I feel so similar. I love python, I’ve spent most of my career writing it. It’s done well for me. But damn is it just not fun anymore. Runtime errors are not fun anymore. Runtimes are not fun. Virtualenvs are not fun anymore even though uv is trying. Typeless loosy goosy code that passes dictionaries all over the place is just not fun. Rust ruined it for me. Or maybe I’m just bored.

>Typeless loosy goosy code that passes dictionaries all over the place is just not fun.

mypy --strict in CI & don't let dict[str, Any] pass review if the keys are constants, insist on a dataclass or at least a TypedDict.


> & don't let dict[str, Any] pass review

good luck with justifying that before your manager (reacting to complaints within your team, claiming you being a bottleneck).


So just make it a dict[str, str] and json encode the payload.

> There are two types of people who use python: those who understand statistics and those who write python. I’m happy that python basically took over the role once filled by matlab […]

This exactly! Worded charitably, but accurately.

Python is a messy and complex language, full of historical baggage and non-essential machinery. I’ve been working in it for many years, so I’m not new or unfamiliar to it… But I know what a clean simple language looks like (eg.: clojure), so I have much less patience for unnecessary complexity now.

It may be arguably-better than some other popular languages (or MATLAB), but it's easy to find an objectively much better high-level language.


Agreed, as an OO scripting language it's lovely, especially compared to Perl where the OO features never meshed quite right. Going back 10 years ago it had a number of things that were novel compared to other languages: literals for common data structures, context managers ("with" statement), first class functions, comprehensions, generators.

On the other hand duck typing is largely a joke. Letting functions take anything as an argument and then just assuming it's a duck with the methods you want is no way to write a robust system. Performance wise you're boxed into a corner. The slow runtime will have you writing native code in another language, complicating your project. The GIL will have you jumping through hoops to work around.

As an offline data exploration and research tool limited to an individual or a small team, or for writing small utilities, I totally get it. For anything mission critical I'd much rather be in something like Java or C# where the typing situation is stronger, the performance is going to be much better, I have better access to threads if I need them, the reasons for dropping into native code are fewer, and the cross platform support works more seamlessly without additional layers like Docker.


>>Agreed, as an OO scripting language it's lovely, especially compared to Perl where the OO features never meshed quite right.

Back then the whole OO crowd was with Java though.

Python's Moat was beginner friendliness to write simple scripts, which at the time- Perl was more like a thermonuclear scripting language. Most people who never wanted to graduate to that advanced stage of writing mega million lines of Perl code over a week(which was literally the use of Perl then), realised they needed some thing simpler, easier to learn, and maintain for smaller scripts- Kind of moved to Python.

But then of course simplicity only takes you that far, and its logically impossible to have a simple clean interface to problems that require several variables tweaked. Python had to evolve and is now having the same bloat and complications that plague any other language.

Having said that, I would still use Java if I had to start a backend project.


When Perl ruled the Earth, the OO crowd was with Smalltalk, Object Pascal, Delphi, Clipper 5, FoxPro, Actor, CA Objects, VB, C++.

In fact, many books that the OOP haters attribute to Java, predate its existence.


> Letting functions take anything as an argument and then just assuming it's a duck with the methods you want is no way to write a robust system

Everyone keeps harping on type safety, but it just doesn't play out in reality. Linux Kernel is incredibly robust, has never been a broken mess, and has basically no type enforcement, as you can cast pointers into other stuff.

In general, all typing does is move error checking into the compiler/preprocessor instead of testing. And time spent on designing and writing type safe code is almost equivalent to time spent writing tests that serve as an end-to-end contract.

There is a reason why NodeJS was the most used language before all the AI stuff came with Python.

>Performance wise you're boxed into a corner. The slow runtime will have you writing native code in another language, complicating your project.

Most of these performance arguments are similar to arguging that your commuter car needs to be a track spec Ferrari in terms of performance, by people that have very little experience with cars.

Plenty of fast/performant stuff runs on Python. PyPy is a thing also. So is launching small compiled executables like a process, that takes literally one line of code in Python.

>The GIL will have you jumping through hoops to work around.

This is just laughable. Clearly you have extremely little experience with Python.


> Linux Kernel is incredibly robust, has never been a broken mess, and has basically no type enforcement

Yes, as a result of strong development practices, a high skill floor, and where work is done by a small number of people knowledgable in the domain. These things are not mutually exclusive with type checking.

> In general, all typing does is move error checking into the compiler/preprocessor instead of testing

Which is an enormously powerful thing. Having those things be required by tests requires that the test exists for all the cases, which turns your tests into things that not only have to test behaviour but are also simultaneously responsible for checking types.

Compile-time type checking can essentially eliminate all need for type-based tests and is able to do it automatically for any code that exists, whereas this has to be opted in when using tests to check types.

You also don't get the benefit of compile-time tests automatically checking use cases for the types you don't support (which is likely more than the ones you do), whereas leaving this to test-time is practically impossible and you can only test the valid path. I've never seen a codebase that checks the negative paths for the hundreds-upon-thousands of types that aren't supported.

None of this is to say I'm against tests as end-to-end contracts, but moving type checking to compile time gives you a lot of extra kinds of assertions for free that you likely don't get from having tests to check types.

> There is a reason why NodeJS was the most used language

And the reason was? AFAIK Node came along as a runtime option for using a familiar language outside of the browser. Coupled with a single-threaded event-driven concurrency model out of the box it was an enormously practical/easy choice from the perspectives of both language familiarity for developers and fpr the workloads it was given.


I dunno where this idea comes from that a code erroring out is somehow catastrophic. If you pass a wrong object type to a function, that mistake is very easy to fix. If you are structuring your code with crazy inheritance to where this error can get hidden, thats solely a you problem.

> I dunno where this idea comes from that a code erroring out is somehow catastrophic.

I mean if it's a medical device it might not be great?

> If you pass a wrong object type to a function, that mistake is very easy to fix.

And with compile time checks you can avoid ever having to get to the point where you have to fix it.


> And time spent on designing and writing type safe code is almost equivalent to time spent writing tests that serve as an end-to-end contract.

Do you write tests for every third-party function that interacts with your code, so that it never fails in runtime after a version bump?

How do you guarantee that your own refactoring is exhaustively covered by the prior tests you've written for the old version?


You don't need a test for every function. You probably want every function call covered by a test, though, otherwise you have untested code.

The exact granularity is a debate that has gone on for a long time. Nowadays, people seem to prefer larger tests that cover more code in one go so as to avoid lots of mocking / stubbing. Super granular tests tend to be reserved for libraries with no internal state.


While what you say could be argued, this is both an insufficient argument against, and irrelevant to, the post you’re commenting on.

> Everyone keeps harping on type safety, but it just doesn't play out in reality.

If you ignore the vast number of cases where it does, and cherry pick an extraordinarily non-representative example like the Linux kernel.

> This is just laughable. Clearly you have extremely little experience with Python.

Or you have extremely little experience with the use cases where it applies, extremely little knowledge of the ongoing effort by the Python developers to address it, and think that ignorant mocking is an argument.


I was a big fan of python between 10 and 15 years ago for similar reasons, it felt "cleaner" than other scripting languages while also having rich standard and extended libraries.

With no real recent experience (I fell deep down the hole into C/kernel etc), I wouldn't have any authority to judge how it's adapted to time. But the most common complaint I've observed at companies of all size and sophistication is "the deployment story is a disaster". But it also seems like uv allows people to do all the "I want this specific version of such and such and I don't want $OS to know about any of this" well?

Re math/ai it's an interesting comment because a language is one part the syntax/stuff you receive, and one part the community that tells you to do things a certain way. I'd guess that Python has become such a big tent it is a little hard to enforce norms that other languages seem to have. This somewhat reminds me of Bjarne Stroustrup discussing scaling/evolving a language.


I think a lot of it is things have shifted away from the raw language. Less and less you’re dealing with Python, and more an assortment of libraries or frameworks. Pandas, numpy, torch, fastapi, …, and a dozen others.

Packaging has been a nightmare. PyPI has had its challenges. Dependency management is vastly improved thanks to uv - recently, and with a graveyard of tools in its wake.

The modern Python script feels more like loosely combining a temperamental set of today’s latest library apis, and then dealing with the fallout. Sometimes parallels the Node experience.

I think an actual Python project - using only something remotely modern like 3.2+ standard library and maybe requests - is probably just as clean, resilient, and reliable as it ever was.

A lot of these things are and/or have been improving tremendously. But think to your point the language (or really the ecosystem) is scaling and evolving a ton and there’s growing pains.


I can see that. A little while ago I was working at a startup and we had a node.js thing that was really crucial to the business that did some gray hat browser automation stuff to scrape TikTok (the users opted into it, but TikTok itself was less permissive). For some reason a person wanted to move part of it to Python to orthogonally solve some other actual problem. They passed me the code and Pandas was there to effectively do an HTTP request and parse JSON and I thought to myself "woah, I'm not in Kansas anymore" -- I ended up not having to worry about it because I ported the idea back to the more mature node system and that turned out to be viable over time.

Libraries can overtake aspects of a language for better and worse. Ruby seemed really tied to Rails and that was great for it as an example.


Ha, Pandas just to parse a website is a bit extra, I’d say. But yeah, it’s weird that you need libraries and api endpoints to do basic tasks these days.

It feels like something broke around 2015-ish. Going back, you could make a whole app and gui with Basic. You could make whole websites simply with HTML+PHP, sometimes using nothing but Notepad. You could make portable apps in Java with no libraries - even Swing or whatever was built in.

Now…? Electron, a few languages, a few frameworks, and a few dozen libraries. Just to start.

Bizzare.


Everyone wants to be a programmer but nobody wants to write any damn code

— Ronnie Coleman


>"super slow bloated researchy untyped ai/math code that's a nightmare to work wit

I love reading comments like this because it just makes me feel good about my job security.

You are aware that things like Youtube and Uber back ends all run on Python, right?


I love reading comments like this because it just makes me feel good about my life choices.

You are aware that things like your bank and insurance all run on COBOL, right?


Also, that UNIX and C praised by so many, are only 14 year younger than COBOL (1959 vs 1973).

I'm happy to see this take gaining some steam. Python got a lot of love while it was growing to where it is now. IMO, that was largely well deserved.

But it seemed like a lot of people overlooked why it was loved. Most of us weren't wishing that our 2k+ line projects were all written in it.

Those little 20-500 line scripts were just so much more fun in Python than anything else though, and it showed up in survey after survey.


> Those little 20-500 line scripts were just so much more fun in Python than anything else though

It's notable that you've written this in the past tense. These kinds of scripts don't seem to be a focus for Python any more.

In fact, I recently heard as justification for a new Python feature: "it helps us with our 100-million-line Python codebase". The language has become extremely complex as it prioritizes the needs of a few teams writing millions of lines over millions of developers each writing relatively few lines.

The reason is that the design team are all working on these large codebases and, understandably, mostly focused on what makes their own lives easier. I was hopeful that in the transition from a BDFL-based governance system to a Steering Council, we would see a larger variety of experience and opinions designing the language. Instead, I don't think there has ever been a single scientist, finance worker etc on the Steering Council - it's always software developers, almost always employees of large software companies.


I’m curious what about the language is getting more complex. Any examples? The ecosystem definitely seems to be getting much more complex, but the language itself hasn’t evolved dramatically since type hints that I can remember.

I've been as programmer for 60 years. I know perl well and it was my go-to scripting language for years although I hated the sigils various other design choices. Only within this year did I set aside the time to learn Python. It didn't take long ... the language is not complex. Of course the libraries and frameworks and deployment tools etc. are extensive and dense and complex because the world has become so complex, extraordinarily so compared to the world when I started programming.

> the language is not complex

It's easy to get started with, but it's certainly not simple. Even small expressions like `a + b` or `a.b` in Python have very complex semantics.


Gee, programming is hard.

The language is not complex.

(And there is a context here, with claims that the language has become complex ... your examples are obviously not relevant to that context.)


Type hints aren’t a single addition - with every release they get more complex. It wouldn’t surprise me if the language included 20+ typing-related PEPs by now.

The other obvious example of complexity is pattern matching. The feature is very complex, especially how it breaks established rules of the language. It also required fundamental changes to the interpreter to accommodate it: a rewrite of the parser from simple LL(1) to PEG.


> It also required fundamental changes to the interpreter to accommodate it: a rewrite of the parser from simple LL(1) to PEG.

The PEP 617[1] (the PEG change) doesn't mention pattern matching at all.

[1] https://peps.python.org/pep-0617


Guido said for many years (decades) that he wanted to get back to the parser.

That has always remained my sole use of Python, scripting OSes and applications, my use of Tcl for application software trained me avoiding languages that always require going down to C for any performance related task.

Best of all with this approach, is that what is in the standard library suffices, no need to mess up with venvs, PYTHONPATH, or whatever is the current trend.


"math code" is generally using wrapped native libraries not really all that slow.

But this seems like an apples to oranges comparison. Yes, of course a few scripts are very different than "something largeish" written in Python


I'm wondering, what language do youb love nowadays?



Python was similar for me after learning Perl and some C in highschool. During university I used Python 2 on and off. It was amazing during that era and what I could build.

Then came Python 3 and it just never felt the same. PyQT projects faltered. Deps split. Strings broke.

However I started using Nim a few years back which has given me that Python 2 feeling – except with static types, better overall language design, meta-programming, and performance!


> However I started using Nim a few years back which has given me that Python 2 feeling – except with static types, better overall language design, meta-programming, and performance!

And except tooling, ecosystem, documentation and practical real-world application.


There are plenty of practical real world usages from companies shipping video games, one of the first and most featureful eth2 servers, websocket servers powering millions of requests at Reddit, etc. Apparently some use in HFT as well now.

True the LSP is pretty bad, but Cursor makes up for a lot of that for me. Atlas dependency manager is great. Valgrind and TSan work perfectly. Gdb sorta works now. LLMS solve the docs issue.

The ecosystem is smaller, but I've been able to use it to successfully create tools for an IoT project with Nim running on an embedded esp32, a multi-threaded api server on linux processing images, and a web SPA with Karax in a couple of weeks of programming work. Oh and calling into Python for some datascience.


I obviously used hyperbole, as probably every single language out there is used in some serious project. And personally I am very fond of D language, so it is not like I am going to shit on Nim or anything else. I just had na impression that your comment implicitly express a sentiment popular on this website - that there is virtually no reason to use shitty Python in AD 2025, as some language X is as good or better in everything.

But then you find out that Nim people still rely on Nimpy, Rust people on PyO3, and even Julia people on PythonCall.

Yeah, no reason to use Python anymore, except by calling Python from your awesome language. The fact that these awesome Python packages are just wrappers over C/C++ doesn't change much - for some reason people using other languages are not willing to write and maintain wrappers of similar quality, including documentation.


Ah good points. I do get a bit triggered from people who do crap on languages when hey you’ve built something, it works well, but it’s not written in whatever fad is current. Then go and rewrite it in react five times.

> The fact that these awesome Python packages are just wrappers over C/C++ doesn't change much - for some reason people using other languages are not willing to write and maintain wrappers of similar quality, including documentation.

True, the older I get the more I’m amazed at communities of people who just build things and keep them running. It’s impressive. But hey calling Python from other languages is pretty sweet.

Though I recently found the Python libraries for automation stuff to be lacking. So I wrote my own library with Claude. I suspect that the friction of creating good wrappers in smaller languages is lowering. I still used Python for actual clicking with a super small rest api.


Would you really feel better about the same volume of Perl code, that was also using some FFI to a heavyweight C or Fortran math library?



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: