Python: "@" followed by a function -> What does it stand for?
Question: I'm currently learning Python and I came across a notation I was wondering
about:

    
    
    import taskmanager as tm
    
    #........
    
    @tm.task(str)
    def feat(folder):
        BLA BLA BLA ...
    

the code is a small excerpt from <https://github.com/kfrancoi/phd-
retailreco/blob/master/libraries/plsa/example_plsa.py> (the file contains
several more notations using the `@` sign). Is this a common notation in
python and what does it mean? Or is this only a notation used in this special
case with the taskmanager or what!?

I tried my best looking this up on google but it's though to find as the
@-sign is stripped out in my search (too short, special character). Same
happens here on Stackoverflow.

Thank you very much in advance


Answer: [This a decorator](https://docs.python.org/2/glossary.html), defined by the
[PEP 318](http://legacy.python.org/dev/peps/pep-0318/). Extract of the
glossary:

> A function returning another function, usually applied as a function
> transformation using the `@wrapper` syntax. Common examples for decorators
> are `classmethod()` and `staticmethod()`.
>
> The decorator syntax is merely syntactic sugar, the following two function
> definitions are semantically equivalent:
>  
>  
>     def f(...):
>         ...
>     f = staticmethod(f)
>  
>     @staticmethod
>     def f(...):
>         ...
>  
>
> The same concept exists for classes, but is less commonly used there. See
> the documentation for function definitions and class definitions for more
> about decorators.

Related: [What are some common uses for Python
decorators?](http://stackoverflow.com/questions/489720/what-are-some-common-
uses-for-python-decorators)

