<div dir="ltr">Dear Pythonistas,<br><br>I've googled for this but I wasn't able to find anything definitive. I was recently looking at scipy to see if I could use it in stead of MATLAB for my class on numerical PDEs, but I noticed that there's some difficulty related to the notation; mainly, the matrix multiplication, and the linear solver (i.e., MATLAB's \ operator). After giving it some thought, I've decided to hold back for now and use MATLAB.<br>
<br>Since scipy/numeric python have been around for a while and some of it is even integrated in Python 2.5, I'm sure this conversation has happened before, so please just educate me. Now I think that there's always going to be people wanting more and more operators in Python (although the operators I'm talking about are privileged -- the Chinese were using matrices some 2000 years ago), so I was thinking that it would be simpler to have a way for defining new infix operators, which would simply be binary functions whose names are punctuation marks; see any language with this feature, e.g., Haskell.<br>
<br>Now since this is such a simple idea, I'm guessing it occured to pythonistas at some point in 1992, and got voted down and that decision has now become scripture. Is that the case?<br><br>The one thing which I found was PEP 211 <a href="http://www.python.org/dev/peps/pep-0211/">http://www.python.org/dev/peps/pep-0211/</a>, which has an amazing quote from James Rawlings. His comment about inv is completely absurd, and while he claims not to know \ and /, he is quoted as an authority on these operators. This particular PEP should probably be deleted from history. For a more authoritative explanation, a quick search yields MathWorks' own Loren Shure: <a href="http://blogs.mathworks.com/loren/2007/05/16/purpose-of-inv/">http://blogs.mathworks.com/loren/2007/05/16/purpose-of-inv/</a><br>
<br>Essentially, in almost all applications, inv(A) is entirely wrong. You can ask any numerical analyst who works with large problems, and they will confirm it. One of the main reason is that, even if A is sparse, inv(A) is full.<br>
<br>That absurdity aside, if I were a language designer, I would be reticent to add one operator to Python (like in PEP 211), because there will always be more operators that people want (how long until someone asks for an operator for the Kronecker product or the convolution?) But why not put in this infix possibility?<br>
<br>Sincerely,<br clear="all"><br>-- <br>Sébastien Loisel<br><br></div>