On Thu, Feb 2, 2023 at 8:34 AM Stephen J. Turnbull < stephenjturnb...@gmail.com> wrote:
> cd...@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: https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode https://oeis.org/wiki/List_of_LaTeX_mathematical_symbols 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. -- Stefane Fermigier - http://fermigier.com/ - http://twitter.com/sfermigier - http://linkedin.com/in/sfermigier Founder & CEO, Abilian - Enterprise Social Software - http://www.abilian.com/ Co-Founder & Co-Chairman, National Council for Free & Open Source Software (CNLL) - http://cnll.fr/ Co-Founder & Chairman, Association Professionnelle Européenne du Logiciel Libre (APELL) - https://www.apell.info/ Co-Founder & Spokesperson, European Cloud Industrial Alliance (EUCLIDIA) - https://www.euclidia.eu/ "I wish you were as accurate, & as much to be relied on, as I am myself" - Lady Ada Lovelace
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/G2XSNXZSTPCDUDIUFHURGIBQ4HO7SG5B/ Code of Conduct: http://python.org/psf/codeofconduct/