newz at bearfruit.org
Mon Jan 14 23:40:44 CET 2008
On 1/14/08, Eli Criffield <elicriffield at gmail.com> wrote:
> You can add functionality to any or every method you define without
> having to change that method, just add the decorator.
> Here's my simple example.
> from decorator import decorator
> def trace(f, *args, **kw):
> print "call %s with args, %s, %s"%(f.func_name,args,kw)
> return f(*args, **kw)
> def sum_three(a, b, c):
> return a + b + c
> print sum_three(1,2,3)
Would you mind explaining what's going on here? I'm not sure what you're
doing. I've heard of decorators but never tried using them.
newz2000 on freenode
More information about the Omaha