james_027 <[EMAIL PROTECTED]> wrote: > While the enhance decorator work with functions of 1 argument, how do > I make it to work with more than one arguments.
Using *args. Something like this: def enhance(f): def _new(*args): return f(*args) + 1 return _new @enhance def f(*args): return sum(args) In [22]: f(6) Out[22]: 7 In [23]: f(6, 4) Out[23]: 11 In [24]: f(6, 4, 10) Out[24]: 21 -- Lawrence, oluyede.org - neropercaso.it "It is difficult to get a man to understand something when his salary depends on not understanding it" - Upton Sinclair -- http://mail.python.org/mailman/listinfo/python-list