Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!tundraware.eternal-september.org!.POSTED!not-for-mail From: Tim Daneliuk Newsgroups: comp.lang.python Subject: Re: What is '@' for Date: Fri, 13 Nov 2015 17:43:15 -0600 Organization: A noiseless patient Spider Lines: 24 Message-ID: <56467593.9060304@tundraware.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: tundraware.eternal-september.org; posting-host="5a15fedc1d2651a6099f1673ffb218fd"; logging-data="32194"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/llz+5jM/8gNDQ0ylU79BnrXD7UjCxZEY=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: Cancel-Lock: sha1:nHWwamVmtMJOkaXAEnEkFydi5bM= Xref: csiph.com comp.lang.python:98781 On 11/13/2015 05:14 PM, Chris Angelico wrote: > On Sat, Nov 14, 2015 at 10:04 AM, fl 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 > One small point of order ... if you want to be precise, "@pymc.deterministic" is a *function decoration*. The "decorator" is the function pymc.deterministic(). I know this is a fussy point, but this distinction is helpful when first learning the concept.