decorators only when __debug__ == True

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Wed Mar 31 21:30:21 EDT 2010


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.



-- 
Steven



More information about the Python-list mailing list