What does the “at” (@) symbol do in Python?

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

Read more here:

PEP 318: Decorators

Python Decorators

The most common Python decorators you’ll run into are:

@property

@classmethod

@staticmethod

If you see an @ in the middle of a line, that’s a different thing, matrix multiplication. See this answer showing the use of @ as a binary operator.

Leave a Comment

tech