[Baypiggies] JJ's decorators

Smith1, Robert E robert.e.smith1 at lmco.com
Sun Mar 8 09:52:40 CET 2009

> It doesn't.  The problem is that there are really two different kinds
> decorators, those without arguments and those that take an argument.
> Unfortunately, the second kind is more complicated,

Thanks for the reply. Now that I think about it, I do seem to recall
Charles Merriam saying that "you get called twice" in the case of
decorators with arguments. So the first return - "return {"pre":
pre_logged, "post": post_logged}[when]" - must be to give Python the
function to call the second time during setup. To my untrained eye it
looks like the "decorator with arguments" scenario could have been
handled with a single call that included the decorated function as an
argument in addition to the arguments for the decorator, but I must be
missing something.

More information about the Baypiggies mailing list