[Tutor] Decorators and function arguments.
Noufal Ibrahim
noufal at airtelbroadband.in
Wed Sep 19 20:22:02 CEST 2007
Kent Johnson wrote:
> Noufal Ibrahim wrote:
>> My question is whether this is a valid use for a decorator and whether
>> this kind of usage is pythonic. If not, are there any better ways to
>> do this?
>
> It seems like a bit of a hack to me. I guess you change the way you call
> run_command to include desc?
Yes. That was the plan. I'd set some keyword arguments that would be
"reserved" for the decorator rather than the function itself.
> You could add another parameter to profile() which says whether to
> include parameters (or how many parameters) in the output. Something like
Thanks Kent. That would keep my original functions unaware that they're
being "decorated". I think it's better.
--
~noufal
More information about the Tutor
mailing list