cdp49@cam.ac.uk writes:
> I don't want to be forced to learn lots of weird little functions
> like `np.matmul(x1, x2)` when there's already one obvious syntax
> I'm very familiar with: `x1 * x2`.
I don't recall ever writing matrix multiplication that way in
mathematics though. That's universally written as juxtaposition in my
experience. And the obvious way to write it in Python (and np) has
been "x1 @ x2" for some years now. In np, "*" means element-wise
multiplication, I believe.
My 2 cents as a former mathematician:
Mathematicians have come up with hundreds of symbols to express the variety of structures they are dealing with.
Just to list a few:
So +, *, -, /, @ and ** are a good start to express the most common mathematical structures (groups, rings, vector spaces), and <, >, <=, >=, ==, != for ordered sets, but that's it.
It's great that Python supports overloading these operations. That's something that drew me to Python when I was still working in computational number theory, 25 years ago.
But that's probably not enough for some people. A way to add new symbols (including non-ascii Unicode characters) and operations could have some value, but also the drawback of tremendous additional complexity, specially if done in the most generic way.
NB: on a very basic level, I remember trying, a few years ago, to use the Unicode "empty set" symbol as a synonym for set(), and it didn't end well, for several reasons, including the fact that Python didn't like it as a variable name.
S.