From the documentation:

The @ (at) operator is intended to be used for matrix multiplication. No builtin Python types implement this operator.

The @ operator was introduced in Python 3.5. @= is matrix multiplication followed by assignment, as you would expect. They map to __matmul__, __rmatmul__ or __imatmul__ similar to how + and += map to __add__, __radd__ or __iadd__.

The operator and the rationale behind it are discussed in detail in PEP 465.

Answer from user1804599 on Stack Overflow
Top answer
1 of 4
276

From the documentation:

The @ (at) operator is intended to be used for matrix multiplication. No builtin Python types implement this operator.

The @ operator was introduced in Python 3.5. @= is matrix multiplication followed by assignment, as you would expect. They map to __matmul__, __rmatmul__ or __imatmul__ similar to how + and += map to __add__, __radd__ or __iadd__.

The operator and the rationale behind it are discussed in detail in PEP 465.

2 of 4
131

@= and @ are new operators introduced in Python 3.5 performing matrix multiplication. They are meant to clarify the confusion which existed so far with the operator * which was used either for element-wise multiplication or matrix multiplication depending on the convention employed in that particular library/code. As a result, in the future, the operator * is meant to be used for element-wise multiplication only.

As explained in PEP0465, two operators were introduced:

  • A new binary operator A @ B, used similarly as A * B
  • An in-place version A @= B, used similarly as A *= B

Matrix Multiplication vs Element-wise Multiplication

To quickly highlight the difference, for two matrices:

A = [[1, 2],    B = [[11, 12],
     [3, 4]]         [13, 14]]
  • Element-wise multiplication will yield:

    A * B = [[1 * 11,   2 * 12], 
             [3 * 13,   4 * 14]]
    
  • Matrix multiplication will yield:

    A @ B  =  [[1 * 11 + 2 * 13,   1 * 12 + 2 * 14],
               [3 * 11 + 4 * 13,   3 * 12 + 4 * 14]]
    

Usage in Numpy

So far, Numpy used the following convention:

  • the * operator (and arithmetic operators in general) were defined as element-wise operations on ndarrays and as matrix-multiplication on numpy.matrix type.

  • method/function dot was used for matrix multiplication of ndarrays

Introduction of the @ operator makes the code involving matrix multiplications much easier to read. PEP0465 gives us an example:

# Current implementation of matrix multiplications using dot function
S = np.dot((np.dot(H, beta) - r).T,
            np.dot(inv(np.dot(np.dot(H, V), H.T)), np.dot(H, beta) - r))

# Current implementation of matrix multiplications using dot method
S = (H.dot(beta) - r).T.dot(inv(H.dot(V).dot(H.T))).dot(H.dot(beta) - r)

# Using the @ operator instead
S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)

Clearly, the last implementation is much easier to read and interpret as an equation.

Discussions

python - What does the @-operator do? - Blender Stack Exchange
I have searched for this in the python docs, numpy docs, blender docs but was not able to find anything. Please excuse me, if this is a dumb answer, but I'm quite frustrated not being able to find anything about that ominous @. ... $\begingroup$ In this case it's matrix-vector multiplication. It also does matrix-matrix multiplication and quaternion-quaternion multiplication. $\endgroup$ ... Let me introduce you to PEP 465 titled "A dedicated infix operator ... More on blender.stackexchange.com
🌐 blender.stackexchange.com
February 28, 2022
Add operator @ for matrix multiplication - language design - Rust Internals
Python chooses @ for matrix multiplication. How about also giving it to rustaceans? More on internals.rust-lang.org
🌐 internals.rust-lang.org
1
January 26, 2022
PEP 465 (matrix multiplication operator) was accepted 3 days ago
Of course, this makes email addresses valid python code: " foo@bar.com " More on reddit.com
🌐 r/Python
18
31
June 19, 2013
PEP 465 -- Dedicated infix operators for matrix multiplication and matrix power
Discussion on the numpy list: http://mail.scipy.org/pipermail/numpy-discussion/2014-March/069439.html Guido's response: https://mail.python.org/pipermail/python-ideas/2014-March/027109.html More on reddit.com
🌐 r/Python
52
75
July 3, 2013
🌐
Python
peps.python.org › pep-0465
PEP 465 – A dedicated infix operator for matrix multiplication | peps.python.org
February 20, 2014 - This PEP proposes a new binary operator to be used for matrix multiplication, called @. (Mnemonic: @ is * for mATrices.) A new binary operator is added to the Python language, together with the corresponding in-place version:
🌐
Alysivji
alysivji.com › python-matrix-multiplication-operator.html
@ Python's Matrix Multiplication Operator - Siv Scripts
# let's put it in matrix form result ... + A[1, 1] * B[1, 1]]]) result ... Looks good! The Python Data Model specifies that the @ operator invokes __matmul__ and __rmatmul__....
🌐
GeeksforGeeks
geeksforgeeks.org › python › what-is-the-symbol-in-python
What Is the @ Symbol in Python? - GeeksforGeeks
July 23, 2025 - The two matrices, matrix_a and matrix_b, are defined as NumPy array. The "@" operator, introduced for matrix multiplication in Python, that utilize to calculate the matrix product of matrix_a and matrix_b.
🌐
Medium
swainshashwat.medium.com › numpy-operator-a-unique-way-to-cross-product-matrices-in-python-b19c9ee886a8
Numpy “@” operator: A unique way to cross product matrices in Python | by Shashwat Sourav Swain | Medium
May 13, 2023 - Numpy “@” operator: A unique way to cross product matrices in Python The @ and @= were introduced in python 3.5 and explicitly used for matrix cross-product multiplication. The introduction of …
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
Matrix operations with NumPy in Python | note.nkmk.me
January 21, 2024 - To calculate matrix multiplication, use the @ operator, np.matmul(), or np.dot(). dot() is also available as a method of ndarray. ... The @ operator is available from Python 3.5 and NumPy 1.10 onwards, and a @ b is equivalent to np.matmul(a, b).
Find elsewhere
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.matmul.html
numpy.matmul — NumPy v2.1 Manual
The matmul function implements the semantics of the @ operator introduced in Python 3.5 following PEP 465. It uses an optimized BLAS library when possible (see numpy.linalg). Examples · For 2-D arrays it is the matrix product: >>> import numpy as np · >>> a = np.array([[1, 0], ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › matrix-manipulation-python
Matrix manipulation in Python - GeeksforGeeks
December 10, 2025 - NumPy provides utility functions to perform common matrix operations like square root, sum, or transpose.
🌐
DataCamp
datacamp.com › doc › numpy › matrix-multiplication
NumPy Matrix Multiplication
Ensure dimensional compatibility. The number of columns in the first matrix must equal the number of rows in the second matrix for multiplication. Use the @ operator for simplicity.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-matrix
Python - Matrix - GeeksforGeeks
July 23, 2025 - To perform transpose operation in matrix we can use the numpy.transpose() method.
🌐
Programiz
programiz.com › python-programming › numpy › matrix-operations
NumPy Matrix Operations (With Examples)
In this example, we have used the np.dot(matrix1, matrix2) function to perform matrix multiplication between two matrices: matrix1 and matrix2.
🌐
Python
docs.python.org › 3 › library › operator.html
operator — Standard operators as functions
The operator module exports a set of efficient functions corresponding to the intrinsic operators of Python. For example, operator.add(x, y) is equivalent to the expression x+y. Many function names are those used for special methods, without ...
🌐
YouTube
youtube.com › neuralnine
Python's @ Operator: The Key to Better Readability in Matrix Operations - YouTube
Today we will learn about the "@" operator, which is used for matrix multiplication.◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾📚 Programming Books & Merch 📚🐍 The Python Bible Book:...
Published   December 31, 2022
Views   9K
🌐
Rust Internals
internals.rust-lang.org › language design
Add operator @ for matrix multiplication - language design - Rust Internals
January 26, 2022 - Python chooses @ for matrix multiplication. How about also giving it to rustaceans?
🌐
Mathspp
mathspp.com › blog › til › 012
TIL #012 – At operator for matrix multiplication | mathspp
Today I learned that Python 3.5+ supports the operator @ for matrix multiplication.
🌐
PyBites Platform
codechalleng.es › bites › 31
PyBites Bite 31. Matrix multiplication / @ operator
Since 3.5 Python has a binary operator to be used for matrix multiplication: @, see PEP 465 -- A dedicated infix operator for matrix multiplication. The @ sign can now be used on types implementing the __matmul__ special/magic/dunder method. It is important to note that whilst this feature shipped in 3.5, none of the standard library builtin types have matrix multiplication implementations.
🌐
Notepad++ Community
community.notepad-plus-plus.org › topic › 17443 › python-lexer-for-matrix-multiply-operator
Python lexer for matrix multiply operator | Notepad++ Community
April 12, 2019 - I’ve noticed that the Python 3.5+ matrix multiply operator @ is lex’d oddly in Notepad++: Here’s how it appears (like all of the other “operators”) in curre...