Is there really an @ operator in Python to calculate dot product?

Viewed 6472

Is this answer correct: https://stackoverflow.com/a/39662710/1175080 ?

Quoting that answer.

In Python 3.5, there is a new operator for the dot product, so you can write a= A @ B instead of a= numpy.dot(A,B)

It does not seem to work for me.

$ python3
Python 3.6.1 (default, Apr  4 2017, 09:40:21) 
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = [1, 2, 3]
>>> b = [4, 5, 6]
>>> a @ b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for @: 'list' and 'list'
>>>

But the linked answer has received 6 upvotes, so I must be missing something. Can you provide a complete example that shows how to use the @ operator to calculate a dot product?

1 Answers
Related