Unsigned_Arduino
Unsigned_Arduino

Reputation: 366

What does @ mean above a function in Python 3?

I was looking through some example code for the skywriter HAT. In there example code, they have this:

@skywriter.move()
def move(x, y, z):
    print( x, y, z )

What does the @ mean above the function? Does it mean whenever skywriter.move() is called it executes move() passing the parameters x, y, and z that was returned from skywriter.move()?

Upvotes: 1

Views: 1873

Answers (1)

z242
z242

Reputation: 435

It is a decorator...basically a wrapper that changes the behavior of the function in some way. For more info google "python decorators".

Some good info here: https://wiki.python.org/moin/PythonDecorators

Upvotes: 2

Related Questions