>>> This follows the principle that it's better to be great

>>> at some things than to be mediocre at everything.

You're right.

>>> >>> I think that weak-left is a little strange, just think

>>> >>> a little of the operators used by mathematicians that

>>> >>> always follow a hierarchy.

>>> Not sure what you mean -- I don't think most mathematicians

>>> think that scalar and matrix multiplication are above or below

>>> each other in precedence, for example.

You're right but on the other hand, I've never seen mixed use of matrix and scalar products without parenthesis... Indeed in math, we can use < Au , Bv > for the scalar product of two matrix-vector products.

But here, I think that the situation is different because we are talking about operators from arrays to array : mainly @ , * and + (elementwise for the two last). Whereas in the preceding example, the scalar product is from arrays to scalar.

As a math user, I think at this point that the arrays-to-array operators must follows a hierarchy.

Who is the guy who have asked such a complicated question about precedence ? :-)

2014-03-18 0:30 GMT+01:00 Nathaniel Smith <njs@pobox.com>:

On Mon, Mar 17, 2014 at 10:33 PM, Christophe Bal <projetmbc@gmail.com> wrote:Not sure what you mean -- I don't think most mathematicians think that

> I think that weak-left is a little strange, just think a little of the

> operators used by mathematicians that always follow a hierarchy.

scalar and matrix multiplication are above or below each other in

precedence, for example. (Well, it's a strange question because scalar

multiplication commutes, but even so, people often forget that these

are even different operations.)

No, that's not how this game is played :-). The way it works is, we

> A parser is mostly done using grammars : see

> http://docs.python.org/3.1/reference/grammar.html.

>

> Defining *-product to have stronger priority than the @-product, and this

> last having stronger priority than +, will make the changes in the grammar

> easier.

>

> I'm now convinced of the usefulness of @ and @@ too but I also think that

> you must think of other uses than only for numpy. In other words, numpy is a

> the good argument for this new operators, but this can also open new

> perspectives for other uses.

figure out the best possible way to handle the use case that we've

demonstrated a need for (matrix multiplication), and then once we've

done that someone might or might not find some other uses too. If they

do then cool, if not then too bad. This follows the principle that

it's better to be great at some things than to be mediocre at

everything.

--

Nathaniel J. Smith

Postdoctoral researcher - Informatics - University of Edinburgh

http://vorpus.org

_______________________________________________

NumPy-Discussion mailing list

NumPy-Discussion@scipy.org

http://mail.scipy.org/mailman/listinfo/numpy-discussion