What is '@' for

Chris Angelico rosuav at gmail.com
Fri Nov 13 18:14:11 EST 2015


On Sat, Nov 14, 2015 at 10:04 AM, fl <rxjwg98 at gmail.com> wrote:
> I read the following code snippet. A question is here about '@'.
> I don't find the answer online yet.
>
> What function is it here?
>
>
> @pymc.deterministic
> def theta(a=alpha, b=beta):
>     """theta = logit^{-1}(a+b)"""
>     return pymc.invlogit(a+b*x)

That's called a "function decorator". And now that you know the name,
you'll be able to find what it is online; as well as the Python docs,
there are a number of blog posts and other articles about it.

ChrisA



More information about the Python-list mailing list