Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98781

Re: What is '@' for

From Tim Daneliuk <tundraBOGUS@tundraware.com>
Newsgroups comp.lang.python
Subject Re: What is '@' for
Date 2015-11-13 17:43 -0600
Organization A noiseless patient Spider
Message-ID <56467593.9060304@tundraware.com> (permalink)
References <b4254670-28c9-4e2c-a221-a27c0d6f62e9@googlegroups.com> <mailman.311.1447456460.16136.python-list@python.org>

Show all headers | View raw


On 11/13/2015 05:14 PM, Chris Angelico wrote:
> On Sat, Nov 14, 2015 at 10:04 AM, fl <rxjwg98@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
> 


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

What is '@' for fl <rxjwg98@gmail.com> - 2015-11-13 15:04 -0800
  Re: What is '@' for Chris Angelico <rosuav@gmail.com> - 2015-11-14 10:14 +1100
    Re: What is '@' for Tim Daneliuk <tundraBOGUS@tundraware.com> - 2015-11-13 17:43 -0600
  Re: What is '@' for Terry Reedy <tjreedy@udel.edu> - 2015-11-13 18:43 -0500
  Re: What is '@' for Dave Farrance <df@see.replyto.invalid> - 2015-11-14 09:14 +0000

csiph-web