Language Delimiters

@ — at sign

Introduces a decorator on a function or class definition. In an expression @ is the distinct matrix multiplication operator, not a decorator.

Formal Syntax & Structure

python syntaxpython
@

Return Value

Not applicable

Grammar token; the enclosing construct determines any result.

Working Example

Example Snippetpython
def decorate(fn):    return lambda: fn().upper()@decoratedef greeting():    return 'hello'print(greeting())
Python Reference