An @ symbol at the beginning of a line is used for class and function decorators:

  • PEP 318: Decorators

  • Python Decorators - Python Wiki

  • The most common Python decorators are:

    • @property
    • @classmethod
    • @staticmethod

An @ in the middle of a line is probably matrix multiplication:

  • @ as a binary operator.
Answer from FogleBird on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ what-is-the-symbol-in-python
What Is the @ Symbol in Python? - GeeksforGeeks
July 23, 2025 - In Python, the "@" symbol is primarily associated with decorators. Decorators are a powerful and flexible way to modify or extend the behavior of functions or methods without changing their code.
๐ŸŒ
Built In
builtin.com โ€บ software-engineering-perspectives โ€บ python-symbol
What Is the @ Symbol in Python? | Built In
March 18, 2025 - The @ symbol in Python is used to apply a decorator to a function or method to extend its functionality, or to help perform matrix multiplication.
Discussions

What is the '@=' symbol for in Python? - Stack Overflow
I know @ is for decorators, but what is @= for in Python? Is it just reservation for some future idea? This is just one of my many questions while reading tokenizer.py. More on stackoverflow.com
๐ŸŒ stackoverflow.com
@ symbol in python
We need to see your code, because your explanation doesn't really tell us what the problem could be. There should be nothing special about that character when reading from or writing to a file. More on reddit.com
๐ŸŒ r/learnpython
7
0
August 9, 2021
Purpose of @ symbols in Python? - Stack Overflow
I've noticed in several examples i see things such as this: # Comments explaining code i think @innerclass or: def foo(): """ Basic Doc String """ @classmethod Googling doesn't get me very far, ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
What does the | symbol do in python?
Depends on context, but if I assume the two operands are numeric, | means bitwise OR. Basically looks at the bits of both numbers and creates a new number with ones where either one of the numbers had one, or both. 0b11100100 | 0b01010101 == 0b11110101 There are other "bitwise" operators, namely AND (&) and XOR (^). More on reddit.com
๐ŸŒ r/learnpython
9
2
May 13, 2022
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ genindex-Symbols.html
Index โ€” Python 3.14.3 documentation
ยฉ Copyright 2001 Python Software Foundation. This page is licensed under the Python Software Foundation License Version 2. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License. See History and License for more information.
๐ŸŒ
Hyperskill
hyperskill.org โ€บ university โ€บ python โ€บ symbols-in-python
Symbols in Python
December 25, 2025 - These symbols improve Pythons functionality and expressiveness. An essential symbol in Python is the '@' symbol, often used as a decorator to alter or expand functions or methods behavior. A decorator is a design pattern that wraps a function or method with functionality without altering its ...
๐ŸŒ
AskPython
askpython.com โ€บ home โ€บ what does the โ€œatโ€ (@) symbol do in python?
What does the "at" (@) symbol do in Python? - AskPython
February 27, 2023 - In Python 3.5, the @ operator can be overloaded. It is termed __matmul__ since it is intended to perform matrix multiplication.
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.

Find elsewhere
๐ŸŒ
Quora
quora.com โ€บ What-does-the-sign-mean-in-Python
What does the '@' sign mean in Python? - Quora
An โ€˜@โ€™ symbol at the beginning of a line is used for class, function and method decorators. Most common - @property @classmethod @staticmethod ยท Also โ€˜@โ€™ is generally used for matrix multiplication(Python 3.5 and above)
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_operators.asp
Python Operators
Python Functions Python Arguments Python *args / **kwargs Python Scope Python Decorators Python Lambda Python Recursion Python Generators Code Challenge Python Range ... Matplotlib Intro Matplotlib Get Started Matplotlib Pyplot Matplotlib Plotting Matplotlib Markers Matplotlib Line Matplotlib Labels Matplotlib Grid Matplotlib Subplot Matplotlib Scatter Matplotlib Bars Matplotlib Histograms Matplotlib Pie Charts
๐ŸŒ
Codecademy
codecademy.com โ€บ forum_questions โ€บ 51a4b238bb4d657b5b003c28
What does this symbol % do in python | Codecademy
I'm working through the section on conditions & control flow and the first comparison is something like this 17
๐ŸŒ
Medium
medium.com โ€บ geekculture โ€บ python-decorators-9a1c42e61a35
Python Decorators. The Fancy @ Symbol | by KP | Geek Culture | Medium
March 10, 2022 - Python Decorators The Fancy @ Symbol If you read code from the top frameworks you may notice an โ€œ@โ€ symbol above some methods. These fancy symbols are called decorators. Python decorators โ€ฆ
๐ŸŒ
Dontusethiscode
dontusethiscode.com โ€บ blog โ€บ 2025-03-12_starting_programming.html
All the Little Symbols in Python (and Why Theyโ€™re There)
But hereโ€™s the thing: they all have a reason for being there. Once you know what they do, Python becomes a lot easier to read (and write). In this week's Cameron's Corner, I will walk you through the most common symbols in beginner Python code, breaking down what they are and why they matter.
๐ŸŒ
Delft Stack
delftstack.com โ€บ home โ€บ howto โ€บ python โ€บ symbol in python
The @ Symbol in Python | Delft Stack
February 2, 2024 - Python ScipyPythonPython TkinterBatchPowerShellPython PandasNumpyPython FlaskDjangoMatplotlibDockerPlotlySeabornMatlabLinuxGitCCppHTMLJavaScriptjQueryPython PygameTensorFlowTypeScriptAngularReactCSSPHPJavaGoKotlinNode.jsCsharpRustRubyArduinoMySQLMongoDBPostgresSQLiteRVBAScalaRaspberry Pi ... The most common use case of the @ symbol in Python is in decorators.
๐ŸŒ
TechBeamers
techbeamers.com โ€บ python-operators-tutorial-beginners
Python Operators Explained with Examples - TechBeamers
December 1, 2025 - This tutorial provides an in-depth overview of Python operators. There are various kinds of operators in Python including Arithmetic, Comparison, Assignment, Logical, Bitwise, Identityโ€ฆ
๐ŸŒ
Python.org
discuss.python.org โ€บ python help
Use of @ (at sign) * in code listings - Python Help - Discussions on Python.org
August 4, 2024 - Hello, I am a total beginner and I am confused by the use of asterisks in books that I am using. For example this code from a beginners book. @dataclass class Product: # three attributes with default values name:str = "" # attribute 1 price:float = 0.0 # attribute 2 discountPercent:float = ...
๐ŸŒ
Quora
quora.com โ€บ What-does-the-symbol-do-in-Python
What does the โ€˜#โ€™ symbol do in Python? - Quora
Answer (1 of 7): Comments in Python are identified with a hash symbol, #, and extend to the end of the line. Hash characters in a string are not considered comments, however. There are three ways to write a comment - as a separate line, beside ...