News for hackers. Stuff that matters.
Re:Pydantic V2 rewritten in Rust is 5-50x faster than Pydant... by crabbone on Saturday April 08, 2023 @09:29AM (#35492888)
For a while, I was meaning to write a package manager for Python, out of total frustration with existing ones.

If I ever find the time and will to actually commit to such a project, I will never use Python for it. There's an obvious reason, which in my case can work as an excuse: not wanting circular dependencies (both pip and conda today depend on Python version and a bunch of Python packages, which makes them flaky / needing multiple versions depending on what Python version is used). But that's just part of the problem.

Python community today houses the worst programmers I know to exist. The quality of community-produced code was and is still degrading fast. I think, Python overtook PHP on this metric a while ago, we just didn't notice it.

So, if I ever make another publicly distributed library for Python, I'm not writing it in Python. Both because I don't want any input from people writing in Python (exclusively) and because with each new version of the language it gets worse. Each new Python release is a step forward and ten steps back: they do fix some bugs, and every now and then clean things up, but they add ten times more garbage to the language than the work they put to make it genuinely better. I feel like if I'm going to chase Python language iterations, I'll be just plugging holes on a sinking ship, and eventually will just run out of stuff to plug the holes with.

Finally, Python doesn't have its own strategy for making Python code to go fast. What I'm talking about is stuff like const correctness in C, or no dynamic memory allocation in C, or eliminating dynamic dispatch in C++ or Java and so on. Many languages have their own "min-game" developers play to make programs faster. In Python, the name of this mini-game is "write in C". It doesn't have to be C specifically, but it's quite obvious that no tricks and backflips you can do in Python alone will ever be comparable performance-wise to simply rewriting even not-very-efficient code to C.

Python is a delivery mechanism today. It's a good delivery mechanism because many people use it. But it's an awful platform for programming. So, if you want comfort in programming and have many users: write in C, and add bindings in Python.

Re:Pydantic V2 rewritten in Rust is 5-50x faster than Pydant... by ilyt on Saturday April 08, 2023 @09:47AM (#35493058)
> Python community today houses the worst programmers I know to exist. The quality of community-produced code was and is still degrading fast. I think, Python overtook PHP on this metric a while ago, we just didn't notice it.

JS topped that metric long time ago;

But it is a curse of every language that gets popular as new developer's first language

Re:Pydantic V2 rewritten in Rust is 5-50x faster than Pydant... by devonkim on Saturday April 08, 2023 @09:58AM (#35493172)
A long time ago I remember people saying that JavaScript is the most popular language that programmers don’t learn. A language with a sufficiently low bar for mass adoption by non-programmers in theory should be useful without needing to know the ins and outs. Yet, I would argue still that the world’s most popular programming language isn’t even either JS or Python or PHP - it’s Excel. When we constrain a programming operating environment and language elegantly it’s quite impressive what is accomplished. We as programmers tend to forget oftentimes that computers and all that stuff is just a means to an end.
Re:Pydantic V2 rewritten in Rust is 5-50x faster than Pydant... by crabbone on Sunday April 09, 2023 @05:32AM (#35501148)
Can you write extensions / modules for VBA used in Excel? -- It's an honest question. I simply haven't used any Microsoft product in a very long time... If not, it's probably not a good delivery mechanism, even if very popular.
Re:Pydantic V2 rewritten in Rust is 5-50x faster than Pydant... by devonkim on Sunday April 09, 2023 @09:51AM (#35502725)
There’s various macro extensions and plugins available including .NET but these options tend to have a long history of horrible security problems because they are general purpose languages. While possible to crash spreadsheets with simple formulas they’re not going to steal your local credentials off disk probably.
Re:Pydantic V2 rewritten in Rust is 5-50x faster than Pydant... by MrJohz on Saturday April 08, 2023 @03:43PM (#35496873)
I'm not entirely sure that's the case. I agree, Javascript is very popular as a first language and an introduction to the world of programming, especially with all of the frontend bootcamp-type courses. But in most of these courses embed a lot of healthy "best practices". Sure, there's often a sense of cargo cult appeal rather than a full explanation, but, for example, most new developers seem to at least have a basic knowledge of git and version control (even if it's often treated as a set of mystical incantations that must be performed before programming). The tooling also helps a lot here, for example by installing dependencies locally and saving a lock file to prevent automagical updates.

Meanwhile, a lot of people who write Python are not necessarily developers, they are scientists or data analysis who just want to turn their data into conclusions. So things like version control are kept largely to one side as unnecessary complexity, and dependency management is often global, ad-hoc, and prone to breaking. Even things like Jupyter - which by itself can be a great tool - tend to push less experienced developers towards spaghetti code and difficult to reproduce results.

In fairness, I think it's difficult to compare these situations and make hard conclusions about which one is better. Ultimately, in both ecosystems, there are some fantastic developers producing excellent tools, frameworks, and libraries. The problem, to the extent that it exists, lies in the low barrier to entry, and the accessibility of these languages, and that's something that's hard to complain too hard about!

Re:Pydantic V2 rewritten in Rust is 5-50x faster than Pydant... by crabbone on Sunday April 09, 2023 @05:29AM (#35501135)
I remember JavaScript from the time it wasn't considered a language anyone would write by hand (RAD controls? Something similar generated by MSVS?). It was supposed to be generated because most people involved with it looked at it with disgust. This tradition, sort of, continues to this day with the most prominent member of the family being TypeScript. So, I'd say, JavaScript community is more aware of the awfulness of their language, and have created an ecosystem where they constantly make efforts to not to write in JavaScript (of course there's also the opposite camp of people who really want to write in JavaScript).
Re:Pydantic V2 rewritten in Rust is 5-50x faster than Pydant... by physPop on Saturday April 08, 2023 @02:23PM (#35496133)
no one should be writing C unless they have a very specific use case. There are so many better safer options like Rust or compile-to-c like Zig, Odin, and Nim.