I\'m looking at some Python code which used the @
symbol, but I have no idea what it does. I also do not know what to search for as searching Python docs or Goo
This code snippet:
def decorator(func):
return func
@decorator
def some_func():
pass
Is equivalent to this code:
def decorator(func):
return func
def some_func():
pass
some_func = decorator(some_func)
In the definition of a decorator you can add some modified things that wouldn't be returned by a function normally.