From: Steve Holden on
MRAB wrote:
> Steven D'Aprano wrote:
>> On Thu, 01 Apr 2010 00:27:51 +0100, MRAB wrote:
>>
>>>>> A decorator shouldn't call the function it's decorating.
>>>> *raises eyebrow*
>>>>
>>>> Surely, in the general case, a decorator SHOULD call the function it is
>>>> decorating? I'm sure you know that, but your wording is funny and could
>>>> confuse the OP.
>>>>
>>> What I mean is that the function that's doing the decorating shouldn't
>>> call the function; it's the locally-defined wrapper function that calls
>>> the decorated function.
>>
>> Ah, gotcha, that makes sense. Now I understand the distinction you
>> were making. Thank you for the clarification.
>>
> I had the following idea: define the terms 'decorator', 'decoration' and
> 'decoratee'. The decorator applies the decoration to the decoratee. The
> decoratee is the function defined locally in the decorator.

It would make more sense (to me, at least) if the decoratee were the
function passed as an argument to the decorator.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/

From: Steve Howell on
On Apr 1, 6:16 am, Steve Holden <st...(a)holdenweb.com> wrote:
> MRAB wrote:
>
> > I had the following idea: define the terms 'decorator', 'decoration' and
> > 'decoratee'. The decorator applies the decoration to the decoratee. The
> > decoratee is the function defined locally in the decorator.
>
> It would make more sense (to me, at least) if the decoratee were the
> function passed as an argument to the decorator.
>

Me too. I do like the idea of coming up with a consistent terminology.
From: MRAB on
Steve Holden wrote:
> MRAB wrote:
>> Steven D'Aprano wrote:
>>> On Thu, 01 Apr 2010 00:27:51 +0100, MRAB wrote:
>>>
>>>>>> A decorator shouldn't call the function it's decorating.
>>>>> *raises eyebrow*
>>>>>
>>>>> Surely, in the general case, a decorator SHOULD call the function it is
>>>>> decorating? I'm sure you know that, but your wording is funny and could
>>>>> confuse the OP.
>>>>>
>>>> What I mean is that the function that's doing the decorating shouldn't
>>>> call the function; it's the locally-defined wrapper function that calls
>>>> the decorated function.
>>> Ah, gotcha, that makes sense. Now I understand the distinction you
>>> were making. Thank you for the clarification.
>>>
>> I had the following idea: define the terms 'decorator', 'decoration' and
>> 'decoratee'. The decorator applies the decoration to the decoratee. The
>> decoratee is the function defined locally in the decorator.
>
> It would make more sense (to me, at least) if the decoratee were the
> function passed as an argument to the decorator.
>
Oops, you're right! What I meant was that the _decoration_ is the
function defined locally in the decorator.
First  |  Prev  | 
Pages: 1 2 3
Prev: "Usability, the Soul of Python"
Next: PyScripter Logo