Reputation: 366
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
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