News for hackers. Stuff that matters.
Re:Python is not a great language for data science. Part 1: ... by OkayPhysicist on Tuesday November 25, 2025 @06:59PM (#46052391)
There's a number of structures that I think are missing in our major programming languages. Tables are one. Matrices are another. Graphs, and relatedly, state machines are tools that are grossly underused because of bad language-level support. Finally, not a structure per se, but I think most languages that are batteries-included enough to included a regex engine should have a a full-fledged PEG parsing engines. Most, if not all, Regex horror stories derive from a simple "Regex is built in".

What tools are easily available in a language, by default, shape the pretty path, and by extension, the entire feel of the language. An example that we've largely come around on is key-value stores. Today, they're table stakes for a standard library. Go back to 90's, and the most popular languages at best treated them as second-class citizens, more like imported objects than something fundamental like arrays. Sure, you can implement a hash map in any language, or import some else's implementation, but oftentimes you'll instead end up with nightmarish, hopefully-synchronized arrays, because those are built-in, and ready at hand.

Re:Python is not a great language for data science. Part 1: ... by throwaway2037 on Tuesday November 25, 2025 @07:23PM (#46052612)

    > There's a number of structures that I think are missing in our major programming languages. Tables are one. Matrices are another.
I disagree. Most programmers will go their entire career and never need a matrix data structure. Sure, they will use libraries that use matrices, but never use them directly themselves. It seems fine that matrices are not a separate data type in most modern programming languages.
Re:Python is not a great language for data science. Part 1: ... by OkayPhysicist on Tuesday November 25, 2025 @07:34PM (#46052688)
Unless you think "most programmers" === "shitty webapp developers", I strongly disagree. Matrices are first class, important components in statistics, data analysis, graphics, video games, scientific computing, simulation, artificial intelligence and so, so much more.

And all of those programmers are either using specialized languages, (suffering problems when they want to turn their program into a shitty web app, for example), or committing crimes against syntax like

rotation_matrix.matmul(vectorized_cat)

Re:Python is not a great language for data science. Part 1: ... by lock1 on Tuesday November 25, 2025 @09:11PM (#46053422)
That's needlessly aggressive. Ignoring webapps, you could do gamedev without even knowing what a matrix is.

You don't even need such construction in most native applications, embedded systems, and OS kernel development.

Re:Python is not a great language for data science. Part 1: ... by theamk on Wednesday November 26, 2025 @12:04AM (#46054354)
I am working in embedded. Had to optimize weights for an embedded algorithm, decided to use linear regression and thus needed matrices.

And if you do robotics, the chances of encountering a matrix are very high.

Re:Python is not a great language for data science. Part 1: ... by throwaway2037 on Wednesday November 26, 2025 @12:04AM (#46054355)
This is my exactly point. Even in a highly specialised library for pricing securities, the amount of code that uses matrices is surprisingly small.
Re:Python is not a great language for data science. Part 1: ... by voidUpdate on Wednesday November 26, 2025 @08:52AM (#46057393)
To be fair, I do use matrices a reasonable amount in gamedev. And if you're writing your engine from scratch, rather than using something like unity, you will almost certainly need matrices
Re:Python is not a great language for data science. Part 1: ... by spookie on Thursday November 27, 2025 @02:00AM (#46066517)
Even when using some game engine you need some prior knowledge. Otherwise you are just throwing stuff at the wall and see if it sticks.
Re:Python is not a great language for data science. Part 1: ... by spookie on Thursday November 27, 2025 @01:58AM (#46066507)
I really doubt this.

Even through UE blueprints (assuming the most high level abstraction here) you will come across the need to perform calculations with matrices. While a lot is abstracted away, you still need to know about coordinate spaces, quirks around order of operations, etc.

Re:Python is not a great language for data science. Part 1: ... by habinero on Wednesday November 26, 2025 @01:38AM (#46054764)
I don't see why the majority of engineers need to cater to your niche use cases. It's a programming language, you can just make the library if it doesn't exist. Nobody's stopping you.

Plus, plenty of third party projects have been incorporated into the Python standard library.

Re:Python is not a great language for data science. Part 1: ... by Koshkin on Wednesday November 26, 2025 @10:56AM (#46058675)
At least in C++ you don't need 'matmul'
Re:Python is not a great language for data science. Part 1: ... by jltsiren on Tuesday November 25, 2025 @10:34PM (#46053929)
When there is no clear canonical way of implementing something, adding it to a programming language (or a standard library) is risky. All too often, you realize too late that you made a wrong choice, and then you add a second version. And a third. And so on. And then you end up with a confusing language full of newbie traps.

Graphs are a good example, as they are a large family of related structures. For example, are the edges undirected, directed, or something more exotic? Do the nodes/edges have identifiers and/or labels? Are all nodes/edges of the same type, or are there multiple types? Can you have duplicate edges between the same nodes? Does that depend on the types of the nodes/edges, or on the labels?

Re:Python is not a great language for data science. Part 1: ... by WorldMaker on Wednesday November 26, 2025 @12:42PM (#46060144)
Even the raw storage for graphs doesn't have just one answer: you could store edge lists or you could store adjacency matrixes. Some algorithms work better with one, some work better with the other. You probably don't want to store both because that can be extra memory overhead as well as a locking problem if you need to atomically update both at once. You probably don't want to automatically flip back and forth between representations because that could cause garbage collector churn if not also long breadth or depth searches, and you may not want to encourage manual conversions between data structures either (to avoid providing a performance footgun to your users). So you probably want the edge list Graph type and the adjacency matrix Graph type to look very different, even though (they are trivially convertible they may be expensive to convert as mentioned), and yeah that's the under-the-hood storage mechanism. From there you get into possible exponential explosion as you start to get into the other higher level distinctions between types of graphs (DAGs versus Trees versus cyclic structures and so forth, and all the variations on what a node can be, if edges can be weighted or labeled, etc).
Re:Python is not a great language for data science. Part 1: ... by HelloNurse on Wednesday November 26, 2025 @04:40AM (#46055797)
> I think most languages that are batteries-included enough to included a regex engine should have a a full-fledged PEG parsing engines

Then there would be more PEG horror stories. In addition, string and indices in regex processing are universal, while a parser is necessarily more framework-like, far more complex and doomed to be mismatched for many applications.

Re:Python is not a great language for data science. Part 1: ... by fluorinerocket on Wednesday November 26, 2025 @05:18PM (#46063002)
Would love to see a language in which hierarchical state machines, math/linear algebra, I/O to sensors and actuators, and time/timing were first class citizens.

Mainly for programming control systems for robotics and aerospace applications

Re:Python is not a great language for data science. Part 1: ... by cmontella on Thursday November 27, 2025 @10:22AM (#46070047)
You might be interested in following my project, as I'm trying to support exactly that nexus of features for those applications!

https://github.com/mech-lang/mech https://www.hytradboi.com/2022/i-tried-rubbing-a-database-on...

Not all features are implemented yet but we are getting there!