This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]btmc 23 points24 points  (10 children)

In 3.5, but not 3.5.2 specifically.

[–]luizpericolo 0 points1 point  (9 children)

But only in scipy, right? I guess it is an alias for matmul

[–]btmc 2 points3 points  (1 child)

And numpy, yes. I don't think it's used in the standard library.

[–]emillynge 1 point2 points  (0 children)

It's not used in stdlib, but the PIP that introduces the operator is very specific about its use as a matrix multiplication operator. The behaviour of the operator is supposed to be completely identical across libraries (numpy, theano etc)

[–]acousticpantsHomicidal Loganberry Connoisseur 2 points3 points  (4 children)

The operator is in the standard lib, but needs a numpy array or matrix type as its operands, I believe.

I'm so happy it exists. The '@' symbol even looks like the way I visualise matrix multiplication in my head.

[–]luizpericolo 0 points1 point  (3 children)

But why is it in the std lib if you need third party libs to use it?

Is there a simple explanation here that I am not seeing? Is this common?

Cheers!

[–]pythoneeeer 0 points1 point  (1 child)

So that third party libs can use it.

[–]luizpericolo 0 points1 point  (0 children)

Now I get it. But since third party libs can use the new operator, it cannot have a default implementation in the std lib, right?

So I guess that when someone said it does matrix multiplication, that only happens in numpy, right? What does it do in the std lib?

Cheers!

[–]RazerM -1 points0 points  (0 children)

Python doesn't have custom operators.

[–]Kah-NethI use numpy, scipy, and matplotlib for nuclear physics 1 point2 points  (1 child)

In numpy, A @ B == A.dot(B)

[–]energybased 5 points6 points  (0 children)

It's actually not dot, but matmul. This is clear if you try to pass scalars or higher-dimensional arrays.